private async Task <User> RegisterExternalUserAsync(AuthUserInfo externalUser)
        {
            var user = await _userRegistrationManager.RegisterAsync(
                externalUser.Name,
                externalUser.PhoneNumber,
                //externalUser.Surname,
                externalUser.EmailAddress,
                externalUser.EmailAddress,
                //Authorization.Users.User.CreateRandomPassword(),
                "000000",
                true
                );

            user.Logins = new List <UserLogin>
            {
                new UserLogin
                {
                    LoginProvider = externalUser.Provider,
                    ProviderKey   = externalUser.ProviderKey,
                    TenantId      = user.TenantId
                }
            };

            //await CurrentUnitOfWork.SaveChangesAsync();

            return(user);
        }
示例#2
0
    public static void OnAuthVk(AuthUserInfo userInfo, string type)
    {
        var main = MAIN.getMain;

        var auth = new AuthApiRequest();

        auth.Aid  = main.applicationID;
        auth.Ui   = userInfo;
        auth.Type = type;
        main.network.ApiRequest(Api.CmdName.Auth, JsonUtility.ToJson(auth));
    }
示例#3
0
    public static void onQuickAuthVk(AuthUserInfo userInfo, string type)
    {
        //print();
        var main = MAIN.getMain;

        var auth = new SidVkAuthApiRequest();

        auth.Sid = main.sessionID;
        auth.Ui  = userInfo;

        main.network.ApiRequest(Api.CmdName.Auth, JsonUtility.ToJson(auth));
    }
示例#4
0
 // когда получили данные об игроке от ВК
 public void onProfileComplete(string msg)
 {
     if (msg != null && (msg != "" || msg != "false"))
     {
         //MAIN main =
         //main.setMessage("onProfileComplete: success: " + msg);
         user = JsonUtility.FromJson <AuthUserInfo>(msg);
         //main.sessionID = PlayerPrefs.GetString(AuthType.VK.ToString(), "");
         if (main.sessionID == "")
         {
             AuthEvent.OnAuthVk(user, AuthTypes.Vk);
         }
         else
         {
             AuthEvent.onQuickAuthVk(user, AuthTypes.Vk);
         }
     }
     else
     {
         main.setMessage("onProfileComplete: error: " + msg);
     }
 }