public async Task <CommonResponce> ChangeProfilePasswordAsync(ChangeProfilePasswordVM oModel) { CommonResponce result = new CommonResponce { Stat = false, StatusMsg = "" }; var oUser = await _DBUserRepository.GetUserByID(oModel.Id).ConfigureAwait(false); if (oUser != null) { if (oUser.Password.Equals(_AppEncription.EncriptWithPrivateKey(oModel.OldPassword))) { oUser.Password = _AppEncription.EncriptWithPrivateKey(oModel.NewPassword); await _DBUserRepository.Update(oUser).ConfigureAwait(false); result.Stat = true; result.StatusMsg = "Successfully changed User password"; } else { result.StatusMsg = "Old Password not Matched"; } } else { result.StatusMsg = "Not a valid User"; } return(result); }
public async Task <JsonResult> ChangeProfilePassword(ChangeProfilePasswordVM model) { if (ModelState.IsValid) { var result = await _AppUserService.ChangeProfilePasswordAsync(model).ConfigureAwait(false); if (result.Stat) { await GetBaseService().AddActivity(ActivityType.Update, model.UserID, model.BUserName, "Change Password", "Changed user password"); return(Json(new { stat = true, msg = "Successfully Changed user password" })); } else { return(Json(new { stat = false, msg = result.StatusMsg })); } } else { return(Json(new { stat = false, msg = "Invalid User change password data" })); } }
public async Task <IActionResult> ChangeProfilePassword() { CreateBreadCrumb(new[] { new { Name = "Home", ActionUrl = "#" }, new { Name = "Change Password", ActionUrl = "/Account/ChangeProfilePassword" } }); BaseViewModel VModel = null; var CurrentUserInfo = GetLoginUserInfo(); var result = await _AppUserService.GetUserProfile(CurrentUserInfo.UserID); if (result.Stat) { UserProfile UserInfo = (UserProfile)result.StatusObj; var TempVModel = new ChangeProfilePasswordVM { Id = UserInfo.Id, UserID = UserInfo.UserId, OldPassword = "", NewPassword = "", ConfirmNewPassword = "" }; VModel = await GetViewModel(TempVModel); } else { var TempVModel = new ChangeProfilePasswordVM { Id = 0, UserID = CurrentUserInfo.UserID, OldPassword = "", NewPassword = "", ConfirmNewPassword = "" }; VModel = await GetViewModel(TempVModel); } return(View(VModel)); }