From 45b91e78fd71fe7ac3391799af54931631222e27 Mon Sep 17 00:00:00 2001 From: jity7777 Date: Mon, 13 Mar 2023 01:30:27 +0000 Subject: [PATCH] =?UTF-8?q?<=EA=B8=B0=EB=8A=A5=EA=B0=9C=EC=84=A0>=201.=20P?= =?UTF-8?q?MS=20NO=20:=202.=20(=EC=A3=BC=EC=9A=94)=EC=9E=91=EC=97=85?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=20(1)=20=EB=B3=B4=EC=95=88=EC=A0=95=EC=B1=85?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EB=B9=84=EB=B2=88=20=EB=A3=B0?= =?UTF-8?q?=20=EC=A0=81=EC=9A=A9(=EC=82=AC=EC=9A=A9=EC=9E=90=EB=8B=A8=20?= =?UTF-8?q?=EC=9D=BC=EA=B4=84=20=EC=A0=81=EC=9A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Base/Controller/FCommonMy.cs | 32 ++++++++++++++++++++++++++++++++ Base/Controller/FOCommon.cs | 10 +++++++++- Dao/MyBatis/Maps/User.xml | 31 +++++++++++++++++++++++++++++-- FO/Views/Account/FindMe.cshtml | 1 + FO/Views/Account/Join.cshtml | 1 + FO/Views/Account/PwChange.cshtml | 14 +++++++++++++- FO/Views/My/MyInfoCheck.cshtml | 16 ++++++++++++++-- FO/js/site.js | 13 +++++++++++++ 8 files changed, 112 insertions(+), 6 deletions(-) diff --git a/Base/Controller/FCommonMy.cs b/Base/Controller/FCommonMy.cs index f98d313..7daae0c 100644 --- a/Base/Controller/FCommonMy.cs +++ b/Base/Controller/FCommonMy.cs @@ -142,6 +142,38 @@ namespace NP.Base.Controllers } return JsonOK(0); } + [HttpPost] + public JsonResult UserPassCheck(Users u, VMUser vm) + { + int passResult = 0; + // 중복 사용된 비번이 있을 경우 0 이상의 숫자가 반환됨 + + if(vm.userno > 0) + { + u.userpass = string.IsNullOrEmpty(u.userpass) ? null : NP.Base.Lib.KISA_SHA256.SHA256Hash(vm.User.userpass.Trim()); + if (u.userpass == null) + { + u.userpass = Request["User.userpass"]; + } + + if (u.userpass != null) + { + u.userpass = NP.Base.Lib.KISA_SHA256.SHA256Hash(vm.User.userpass.Trim()); + passResult = Dao.Get("users.pass.check", new System.Collections.Hashtable() { { "userno", vm.userno }, { "userpass", u.userpass } }).FirstOrDefault(); + } + } + else + { + u.userpass = string.IsNullOrEmpty(u.userpass) ? null : NP.Base.Lib.KISA_SHA256.SHA256Hash(u.userpass.Trim()); + if (u.userpass != null) + { + passResult = Dao.Get("users.pass.check", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo }, { "userpass", u.userpass } }).FirstOrDefault(); + } + } + + return JsonOK(passResult); + } + [HttpPost] public JsonResult UserExit(String exitreason) { diff --git a/Base/Controller/FOCommon.cs b/Base/Controller/FOCommon.cs index f831cc2..8c1ad73 100644 --- a/Base/Controller/FOCommon.cs +++ b/Base/Controller/FOCommon.cs @@ -151,7 +151,15 @@ namespace NP.Base.Controllers } if (vm.userno > 0 && !string.IsNullOrEmpty(vm.User.userpass) && vm.User.userpass.Trim() != "") { - if (Dao.Save("users.resetuserpass", new Hashtable() { { "userpass", NP.Base.Lib.KISA_SHA256.SHA256Hash(vm.User.userpass) }, { "userno", vm.userno } }) == 1) + //if (Dao.Save("users.resetuserpass", new Hashtable() { { "userpass", NP.Base.Lib.KISA_SHA256.SHA256Hash(vm.User.userpass) }, { "userno", vm.userno } }) == 1) + //{ + // var u = GoLogin(vm.User.userid, vm.User.userpass); + // if (u != null) + // { + // return JsonOK(1); + // } + //} + if (Dao.Save("users.resetuserpass", new Hashtable() { { "userpass", NP.Base.Lib.KISA_SHA256.SHA256Hash(vm.User.userpass) }, { "userno", vm.userno } }) > 0) { var u = GoLogin(vm.User.userid, vm.User.userpass); if (u != null) diff --git a/Dao/MyBatis/Maps/User.xml b/Dao/MyBatis/Maps/User.xml index 88ba4b2..89b96f8 100644 --- a/Dao/MyBatis/Maps/User.xml +++ b/Dao/MyBatis/Maps/User.xml @@ -339,7 +339,25 @@ SELECT LAST_INSERT_ID() + + + + + insert into userpasslog (userno, userpass, cdt, uip) + select #userno#, #userpass#, now(), #uip# + from (select 1 col1) a + left outer join userpasslog b on b.userno=#userno# + where b.userno is null; + + update userpasslog set userpass = #userpass# + where userno=#userno#; + + update users set ,usertype=#usertype# ,userkind =#userkind# @@ -381,7 +399,7 @@ ,di =case when #di# is not null then #di# else di end ,ci =case when #ci# is not null then #ci# else ci end ,vssn =case when #vssn# is not null then #vssn# else vssn end - where userno=#userno# + where userno=#userno#; update users set @@ -837,7 +855,16 @@ - update users set userpass=#userpass#,udt= where userno=#userno# + insert into userpasslog (userno, userpass, cdt, uip) + select #userno#, #userpass#, now(), #uip# + from (select 1 col1) a + left outer join userpasslog b on b.userno=#userno# + where b.userno is null; + + update userpasslog set userpass = #userpass# + where userno=#userno#; + + update users set userpass=#userpass#,udt= where userno=#userno#;