From 374ce4ffd0c459bb4067e8d5765f972668aff9b1 Mon Sep 17 00:00:00 2001 From: wzp <2040239371@qq.com> Date: 星期四, 02 三月 2023 14:56:23 +0800 Subject: [PATCH] 变更oracle访问组件 --- web/web/Session.ashx | 38 +++++++++++++++++++++++--------------- 1 files changed, 23 insertions(+), 15 deletions(-) diff --git a/web/web/Session.ashx b/web/web/Session.ashx index abb9f06..f4ad021 100644 --- a/web/web/Session.ashx +++ b/web/web/Session.ashx @@ -89,11 +89,17 @@ 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) "瀵嗙爜鏇存柊鎴愬姛锛�"); @@ -101,25 +107,25 @@ 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 = "楠岃瘉鐮侀敊璇紝璇烽噸鏂拌緭鍏ワ紒", @@ -129,7 +135,9 @@ 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 = "鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒锛�", @@ -137,13 +145,13 @@ }); } 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)) -- Gitblit v1.9.1