public IServerResponse ChangePassword(ChangePasswordInfo changePasswordInfo) { Assert.IsNotNull(changePasswordInfo); Assert.IsStringNotNullOrEmpty(changePasswordInfo.OldPassword); Assert.IsStringNotNullOrEmpty(changePasswordInfo.NewPassword); Assert.AreEqual(changePasswordInfo.NewPassword, changePasswordInfo.ConfirmPassword); IServerResponse response = serverProvider.ChangePassword(changePasswordInfo); return response; }
public ActionResult ChangePassword(ChangePasswordInfo model) { if (ModelState.IsValid) { var response = ssoClientProvider.ChangePassword(model); if (response.Status == ResponseStatus.Success) { return RedirectToAction("ChangePasswordSuccess"); } else { ViewBag.Message = response.Message; } } return View(model); }
public IServerResponse ChangePassword(ChangePasswordInfo changePasswordInfo) { Assert.IsNotNull(changePasswordInfo); Assert.IsStringNotNullOrEmpty(changePasswordInfo.OldPassword); Assert.IsStringNotNullOrEmpty(changePasswordInfo.NewPassword); Assert.AreEqual(changePasswordInfo.NewPassword, changePasswordInfo.ConfirmPassword); IServerResponse response = null; var chanel = CreateChannel(); chanel.Call(p => { response = p.ChangePassword(changePasswordInfo); }); return response; }
public IServerResponse ChangePassword(ChangePasswordInfo changePasswordInfo) { var client = GetClient(changePasswordInfo.ClientId); var encryptor = GetClientEncryptor(client); var hpwd = pwdEncryptor.Encrypt(changePasswordInfo.OldPassword); var obj = repoUser.Query(o => o.UserId == changePasswordInfo.UserId && o.Password == hpwd).FirstOrDefault(); ServerResponse<Session> response = new ServerResponse<Session>(); if (obj == null) { response.Status = ResponseStatus.Failed; response.Message = DAF.SSO.Resources.Locale(o => o.AccountNotFound); } else { if (changePasswordInfo.NewPassword != changePasswordInfo.ConfirmPassword) { response.Status = ResponseStatus.Failed; response.Message = DAF.SSO.Resources.Locale(o => o.ConfirmPasswordIsNotSameToPassword); } else { obj.Password = pwdEncryptor.Encrypt(changePasswordInfo.NewPassword); if (repoUser.Update(obj)) { response.Status = ResponseStatus.Success; response.Message = DAF.SSO.Resources.Locale(o => o.ChangePasswordSuccessfully); } else { response.Status = ResponseStatus.Failed; response.Message = DAF.Core.Resources.Locale(o => o.SaveFailure); } } } return response; }
public IServerResponse ChangePassword(ChangePasswordInfo changePasswordInfo) { return serverProvider.ChangePassword(changePasswordInfo); }
public ActionResult ChangePassword() { ChangePasswordInfo model = new ChangePasswordInfo(); return View(model); }
public static ServerResponse ChangePassword(string oldPassword, string newPassword, string confirmPassword) { ServerResponse response = new ServerResponse(); if (IsAuthenticated) { ChangePasswordInfo info = new ChangePasswordInfo() { ClientId = CurrentClient.ClientId, SessionId = HttpContext.Current.Session.SessionID, DeviceId = HttpContext.Current.Request.UserHostAddress, DeviceInfo = HttpContext.Current.Request.UserAgent, UserId = CurrentSession.User.UserId, OldPassword = oldPassword, NewPassword = newPassword, ConfirmPassword = confirmPassword }; try { var cp = IocInstance.Container.Resolve<ISSOClientProvider>(); var r = cp.ChangePassword(info); response.Status = r.Status; response.Message = r.Message; } catch (Exception ex) { response.Status = ResponseStatus.Exception; response.Message = ex.Message; } } else { response.Status = ResponseStatus.Failed; response.Message = DAF.SSO.Resources.Locale(o => o.RequireAuthentication); } return response; }