public ActionResult ModifyEmail(string email) { if (String.IsNullOrEmpty(email)) { return(Json(false)); } var u = CurrentUser; if (u != null) { u.UserMail = email; try { var count = BusinessHelper.UserHelper.Update(u, "UserMail"); if (count == 1) { OperLogHelper.AddOperLog($"{Username} 修改邮箱账号为{email} {DateTime.Now:yyyy-MM-dd HH:mm:ss}", OperLogModule.Account, Username); AuthFormService.SetCurrentUser(u); return(Json(true)); } } catch (Exception ex) { Logger.Error(ex); } } return(Json(false)); }
public ActionResult LogOn(LoginViewModel model) { if (ModelState.IsValid) { if (!ValidateValidCode(model.RecaptchaType, model.Recaptcha)) { return(Json("验证码有误")); } var u = new User { UserName = model.UserName, UserPassword = model.Password }; //是否登录成功逻辑添加 u = BusinessHelper.UserHelper.Login(u); if (u != null) { AuthFormService.Login(model.UserName, model.RememberMe); AuthFormService.SetCurrentUser(u); return(Json("")); } } return(Json("登录失败,用户名或密码错误")); }