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#;