protected override async Task <ExternalAccount> CreateNewExternalAccountForRegistrationAsync(Registration registration) { var user = registration.User; //if (user.Archived) //{ // throw new InvalidOperationException($"User {user.Id} is archived"); //} //if (!user.EmailConfirmed) //{ // throw new InvalidOperationException($"User {user.Id} email {user.Email} is not confirmed yet"); //} // TODO: check other registration rules? // we will use Auth0 as auth provider, no password will be required // but to fill the required information we generate it here. var password = PasswordHelper.GeneratePassword(6); var lastName = registration.ParticipantLastName ?? "Unspecified"; var login = new Regex("[^a-z0-9@_\\-\\.]").Replace(user.UserName, "-"); var response = await _apiService.UserSignUpAsync(new TalentLmsUserSignUpRequest { FirstName = registration.ParticipantFirstName, LastName = lastName, Login = login, Email = user.Email, Password = password }); return(new ExternalAccount { UserId = registration.UserId, ExternalAccountId = response.Id, ExternalServiceName = Name, DisplayName = $"{response.FirstName} {response.LastName}" }); }
public async Task User_Sign_Up_Must_Require_Non_Null_Request() { await Assert.ThrowsAsync <ArgumentNullException>(() => _service.UserSignUpAsync(null)); }