/// <summary> /// 退出登录 /// </summary> /// <returns></returns> public ActionResult Logout() { Logger.Info($"{Username} logout at {DateTime.Now:yyyy-MM-dd HH:mm:ss}"); //logout AuthFormService.Logout(); //redirect to login page return(RedirectToAction("Login")); }
/// <summary> /// 退出登录 /// </summary> /// <returns></returns> public ActionResult Logout() { Logger.Info($"{Username} logout at {DateTime.Now:yyyy-MM-dd HH:mm:ss}"); //logout AuthFormService.Logout(); //redirect to login page return(RedirectToAction("Index", new { area = "", controller = "Home" })); }
public ActionResult ModifyPassword(ModifyPasswordViewModel model) { if (ModelState.IsValid) { if (CurrentUser == null) { return(Json(false)); } try { //判断原密码是否正确,原密码正确的情况才能修改密码 if (CurrentUser.UserPassword.Equals(SecurityHelper.SHA256_Encrypt(model.OldPassword))) { CurrentUser.UserPassword = SecurityHelper.SHA256_Encrypt(model.NewPassword); if (BusinessHelper.UserHelper.Update(CurrentUser, "UserPassword") > 0) { OperLogHelper.AddOperLog($"{Username} 修改密码 {DateTime.Now:yyyy-MM-dd HH:mm:ss}", OperLogModule.Account, Username); Logger.Info($"{Username} modify password at {DateTime.Now:yyyy-MM-dd HH:mm:ss}"); //密码修改成功,需要重新登录 AuthFormService.Logout(); return(Json(true)); } } else { //原密码错误 } } catch (Exception ex) { Logger.Error(ex); } } return(Json(false)); }