public async Task <AccountResult> SignUp(SignUp entity) { var user = _pool.GetUser(entity.Email); if (user.Status != null) { return new AccountResult { Succeeded = false, Errors = new List <ErrorsResult> { new ErrorsResult(HttpStatusCode.NotFound, "Invalid status") } } } ; user.Attributes.Add(CognitoAttribute.Name.AttributeName, entity.Name); return(_resultMap.Map(await _userManager.CreateAsync(user, entity.Password).ConfigureAwait(false))); } }
public async Task <AccountResult> Confirm(Confirm entity) { CognitoUser user = await _userManager.FindByEmailAsync(entity.Email).ConfigureAwait(false); return(user == null?AddError() : _resultMap.Map(await((CognitoUserManager <CognitoUser>)_userManager).ConfirmSignUpAsync(user, entity.Code, true).ConfigureAwait(false))); }
public async Task <AccountResult> ResetPassword(ResetPasword entity) { CognitoUser user = await _userManager.FindByEmailAsync(entity.Username).ConfigureAwait(false); return(user == null?AddError() : _resultMap.Map(await _userManager.ResetPasswordAsync(user, entity.Token, entity.NewPassword).ConfigureAwait(false))); }