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); }
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)); }
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)); }
// когда получили данные об игроке от ВК 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); } }