Beispiel #1
0
        public MediatorResponse <ForgottenCredentialsViewModel> ForgottenEmail(ForgottenCredentialsViewModel forgottenCredentialsViewModel)
        {
            var forgottenEmailViewModel = forgottenCredentialsViewModel.ForgottenEmailViewModel;
            var validationResult        = _forgottenEmailViewModelServerValidator.Validate(forgottenEmailViewModel);

            if (!validationResult.IsValid)
            {
                return(GetMediatorResponse(LoginMediatorCodes.ForgottenEmail.FailedValidation, forgottenCredentialsViewModel, validationResult));
            }

            var message = string.Format(LoginPageMessages.ForgottenEmailSent, forgottenEmailViewModel.PhoneNumber);

            if (_candidateServiceProvider.RequestEmailReminder(forgottenEmailViewModel))
            {
                return(GetMediatorResponse(LoginMediatorCodes.ForgottenEmail.EmailSent, forgottenCredentialsViewModel, message, UserMessageLevel.Success));
            }

            return(GetMediatorResponse(LoginMediatorCodes.ForgottenEmail.FailedToSendEmail, forgottenCredentialsViewModel, message, UserMessageLevel.Success));
        }