public async Task <IActionResult> ResetPassword(AdminUserResetPasswordModel model) { if (this.ModelState.IsValid) { try { if (model.Password != model.PasswordRe) { model.FormMessage = "Şifre ve tekrarı aynı olmalıdır."; return(View((object)model)); } Result result = await _panelUserService.ResetPasswordAsync(model.Code, model.Email, model.Password); if (!result.IsSuccess) { model.FormMessage = result.FormMessage; return(View((object)model)); } model.IsSuccess = true; model.FormMessage = "Yeni şifreniz ile giriş yapabilirsiniz."; return(View((object)model)); } catch (Exception ex) { LoggerExtensions.LogError(_logger, ex, "Panel ResetPassword Error", Array.Empty <object>()); model.FormMessage = "İşleminiz gerçekleştirilemedi."; return(View((object)model)); } } return(View((object)model)); }
public IActionResult ResetPassword(string code) { if (string.IsNullOrWhiteSpace(code)) { return(this.RedirectToAction("Login")); } AdminUserResetPasswordModel adminUserResetPasswordModel = new AdminUserResetPasswordModel { Code = code }; return(View((object)adminUserResetPasswordModel)); }
public async Task ResetPassword(AdminUserResetPasswordModel model) { var adminUser = await GetItem(new Guid(model.Id)); if (adminUser == null) { throw new UserNotFoundException(); } if (string.Compare(_hashingService.DecryptString(adminUser.Password), model.ConfirmPassword, false) != 0) { throw new PasswordsDoNotMatchException(); } adminUser.Password = _hashingService.EncryptString(model.ResetPassword); adminUser = await _adminUsersManager.UpsertItemAsync(adminUser); }
public async Task <IActionResult> ResetPassword(AdminUserResetPasswordModel model) { try { await _adminUserService.ResetPassword(model); response = new ApiResponse(HttpStatusCode.OK, "Admin user password reset successfully.", null); return(Ok(new { response })); } catch (UserNotFoundException exception) { response = new ApiResponse(HttpStatusCode.NotFound, exception.Message, null); return(Ok(new { response })); } catch (PasswordsDoNotMatchException exception) { response = new ApiResponse(HttpStatusCode.Conflict, exception.Message, null); return(Ok(new { response })); } catch (Exception exception) { return(BadRequest("Admin user update failed. Error: " + exception.Message)); } }
public AdminUserResetPassword(AdminUserResetPasswordModel entity) { ResetPassword = entity.ResetPassword; ConfirmPassword = entity.ConfirmPassword; }