| | |
| | | string account = context.SessionObject.Account; |
| | | if (string.IsNullOrEmpty(account)) |
| | | throw new ArgumentException("获取账户信息出错,请重新登录!"); |
| | | |
| | | this.dao.GetUser(account); |
| | | SysUser userInfo = this.dao.GetUserInfo(context.SessionObject.UserID); |
| | | |
| | | string1 += userInfo.Salt; |
| | | |
| | | string str = userInfo.Password == DataHelper.MD5Hex(string1) ? userInfo.Password : string1; |
| | | if (!string.Equals(context.SessionObject.Password, str)) |
| | | throw new ArgumentException("原始密码不正确,请重新输入!"); |
| | | |
| | | string3 += userInfo.Salt; |
| | | if (this.dao.UpdatePassword(context.SessionObject.UserID, str, DataHelper.MD5Hex(string3))) |
| | | context.SessionObject.Password = DataHelper.MD5Hex(string3); |
| | | return new JsonPageResult(true, (object) "密码更新成功!"); |
| | |
| | | |
| | | private JsonPageResult Login(PageContext<SysUser> context) |
| | | { |
| | | string a = context.Session["Code"] as string; |
| | | string string1 = context.GetString("code"); |
| | | string string2 = context.GetString("account"); |
| | | string string3 = context.GetString("password"); |
| | | string sessionCode = context.Session["Code"] as string; |
| | | string code = context.GetString("code"); |
| | | string account = context.GetString("account"); |
| | | string password = context.GetString("password"); |
| | | string str = "登录成功!"; |
| | | int num = 2; |
| | | if (string.IsNullOrEmpty(string2)) |
| | | if (string.IsNullOrEmpty(account)) |
| | | return new JsonPageResult(false, (object) new |
| | | { |
| | | Content = "请输入账号后再登录!", |
| | | Tstatus = num |
| | | }); |
| | | if (string.IsNullOrEmpty(string3)) |
| | | if (string.IsNullOrEmpty(password)) |
| | | return new JsonPageResult(false, (object) new |
| | | { |
| | | Content = "请输入密码后再登录!", |
| | | Tstatus = num |
| | | }); |
| | | if (!string.Equals(a, string1, StringComparison.OrdinalIgnoreCase)) |
| | | if (!string.Equals(sessionCode, code, StringComparison.OrdinalIgnoreCase)) |
| | | return new JsonPageResult(false, (object) new |
| | | { |
| | | Content = "验证码错误,请重新输入!", |
| | |
| | | |
| | | try |
| | | { |
| | | if (!this.dao.CheckLogin(string2, string3, user)) |
| | | user = this.dao.GetUser(account); |
| | | password += user.Salt; |
| | | if (!this.dao.CheckLogin(account, password, user)) |
| | | return new JsonPageResult(false, (object)new |
| | | { |
| | | Content = "用户名或密码错误!", |
| | |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new JsonPageResult(false, (object)new |
| | | { |
| | | Content = "异常:"+ex.Message, |
| | | Tstatus = num |
| | | }); |
| | | } |
| | | { |
| | | return new JsonPageResult(false, (object)new |
| | | { |
| | | Content = "异常:"+ex.Message, |
| | | Tstatus = num |
| | | }); |
| | | } |
| | | context.SessionObject = user; |
| | | string clientIp = user.ClientIp; |
| | | if (user.IsVerification == 1 && !context.ClientIP.Equals(clientIp)) |