public MediatorResponse <ForgottenPasswordViewModel> ForgottenPassword(ForgottenPasswordViewModel forgottenPasswordViewModel) { var validationResult = _forgottenPasswordViewModelServerValidator.Validate(forgottenPasswordViewModel); if (!validationResult.IsValid) { return(GetMediatorResponse(RegisterMediatorCodes.ForgottenPassword.FailedValidation, forgottenPasswordViewModel, validationResult)); } if (_candidateServiceProvider.RequestForgottenPasswordResetCode(forgottenPasswordViewModel)) { return(GetMediatorResponse(RegisterMediatorCodes.ForgottenPassword.PasswordSent, forgottenPasswordViewModel)); } return(GetMediatorResponse(RegisterMediatorCodes.ForgottenPassword.FailedToSendResetCode, forgottenPasswordViewModel, PasswordResetPageMessages.FailedToSendPasswordResetCode, UserMessageLevel.Warning)); }
public async Task <ActionResult> ResendPasswordResetCode(string emailAddress) { return(await Task.Run(() => { var model = new ForgottenPasswordViewModel { EmailAddress = emailAddress }; UserData.Push(UserDataItemNames.EmailAddress, model.EmailAddress); if (_candidateServiceProvider.RequestForgottenPasswordResetCode(model)) { SetUserMessage(string.Format(PasswordResetPageMessages.PasswordResetSent, emailAddress)); } else { SetUserMessage(PasswordResetPageMessages.FailedToSendPasswordResetCode, UserMessageLevel.Warning); } return RedirectToRoute(RouteNames.ResetPassword); })); }