From 1845e4274cd032108ae79cdc8d7dc84e196abe74 Mon Sep 17 00:00:00 2001 From: lch Date: Wed, 9 Jun 2021 05:29:52 +0000 Subject: [PATCH] =?UTF-8?q?=EC=9D=B8=EC=A6=9D=20DI=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Base/Controller/FCommonMy.cs | 58 +++++---- Dao/MyBatis/Maps/User.xml | 5 +- FO/Controllers/AccountController.cs | 175 +++++++++++++++++++++++----- FO/Controllers/CDMSController.cs | 2 +- FO/Views/Account/CertOk3IPIN.cshtml | 2 +- FO/Views/Account/CertOk3MOBI.cshtml | 8 +- 6 files changed, 185 insertions(+), 65 deletions(-) diff --git a/Base/Controller/FCommonMy.cs b/Base/Controller/FCommonMy.cs index 6f31f13..a4fe29b 100644 --- a/Base/Controller/FCommonMy.cs +++ b/Base/Controller/FCommonMy.cs @@ -102,35 +102,43 @@ namespace NP.Base.Controllers [HttpPost] public JsonResult UserSave(Users u) { - u.userno = SUserInfo.UserNo; - u.uno = SUserInfo.UserNo; - u.uip = GetUserIP(); - u.usertype = 1; - u.userpass = string.IsNullOrEmpty(u.userpass) ? null : NP.Base.Lib.KISA_SHA256.SHA256Hash(u.userpass.Trim()); - var telno = (u.telno ?? "").Replace("-", ""); - u.telno = telno.Length == 11 ? string.Format("{0}-{1}-{2}", telno.Substring(0, 3), telno.Substring(3, 4), telno.Substring(7, 4)) : - telno.Length == 10 ? string.Format("{0}-{1}-{2}", telno.Substring(0, 3), telno.Substring(3, 3), telno.Substring(6, 4)) : - telno.Length == 9 ? string.Format("{0}-{1}-{2}", telno.Substring(0, 2), telno.Substring(2, 3), telno.Substring(5, 4)) : - telno.Length == 8 ? string.Format("{0}-{1}", telno.Substring(0, 4), telno.Substring(4, 4)) : - telno.Length == 7 ? string.Format("{0}-{1}", telno.Substring(0, 3), telno.Substring(3, 4)) : u.telno; - var check = Dao.Get("users.checkuser", new Hashtable() { { "usernonot", SUserInfo.UserNo }, { "email", u.email },{"mobile",u.mobile } }).First(); - if (check < 9) + var user = Dao.Get("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault(); + if (user != null) { - return JsonOK(check * -1); - } - LogSet(new ActLog() { logtype = 30, logtarget = 21, logdata = u.username, userno = u.userno, uno = SUserInfo.UserNo, uip = GetUserIP() }); - u.savefrontbuy = 1; - var result = Dao.Save("users.up", u); - if (result > 0) - { - var asno = u.asno ?? 0; - if (SUserInfo.ASNo != asno) + if (string.IsNullOrEmpty(user.di) || user.di == u.di) { - SUserInfo.ASNo = asno; - AuthCookie(true); + u.userno = SUserInfo.UserNo; + u.uno = SUserInfo.UserNo; + u.uip = GetUserIP(); + u.usertype = 1; + u.userpass = string.IsNullOrEmpty(u.userpass) ? null : NP.Base.Lib.KISA_SHA256.SHA256Hash(u.userpass.Trim()); + var telno = (u.telno ?? "").Replace("-", ""); + u.telno = telno.Length == 11 ? string.Format("{0}-{1}-{2}", telno.Substring(0, 3), telno.Substring(3, 4), telno.Substring(7, 4)) : + telno.Length == 10 ? string.Format("{0}-{1}-{2}", telno.Substring(0, 3), telno.Substring(3, 3), telno.Substring(6, 4)) : + telno.Length == 9 ? string.Format("{0}-{1}-{2}", telno.Substring(0, 2), telno.Substring(2, 3), telno.Substring(5, 4)) : + telno.Length == 8 ? string.Format("{0}-{1}", telno.Substring(0, 4), telno.Substring(4, 4)) : + telno.Length == 7 ? string.Format("{0}-{1}", telno.Substring(0, 3), telno.Substring(3, 4)) : u.telno; + var check = Dao.Get("users.checkuser", new Hashtable() { { "usernonot", SUserInfo.UserNo }, { "email", u.email }, { "mobile", u.mobile } }).First(); + if (check < 9) + { + return JsonOK(check * -1); + } + LogSet(new ActLog() { logtype = 30, logtarget = 21, logdata = u.username, userno = u.userno, uno = SUserInfo.UserNo, uip = GetUserIP() }); + u.savefrontbuy = 1; + var result = Dao.Save("users.up", u); + if (result > 0) + { + var asno = u.asno ?? 0; + if (SUserInfo.ASNo != asno) + { + SUserInfo.ASNo = asno; + AuthCookie(true); + } + } + return JsonOK(result); } } - return JsonOK(result); + return JsonOK(0); } [HttpPost] public JsonResult UserExit(String exitreason) diff --git a/Dao/MyBatis/Maps/User.xml b/Dao/MyBatis/Maps/User.xml index 249ee11..3afecb3 100644 --- a/Dao/MyBatis/Maps/User.xml +++ b/Dao/MyBatis/Maps/User.xml @@ -238,7 +238,7 @@ ,case when c.refcode='9' then a.ccpositionetc else c.cname end ccpositionname ,case when a.usertype=1 then '교육생' when d.authname is null then '-' else d.authname end usertypestr ,CAST(AES_DECRYPT(UNHEX(a.birthday), ) AS char) birthday - ,a.uduty,a.slevel,a.isacceptmobile,a.vssn,a.ischkatt,a.authplatform + ,a.uduty,a.slevel,a.isacceptmobile,a.vssn,a.di,a.ci,a.ischkatt,a.authplatform ,row_number() over(order by $orderby$a.username) rno ,count(a.cdt) over() pagetotalcount from users a @@ -252,7 +252,7 @@ and a.usertype <> 91 and a.userno =#userno# - and a.userno <> #userno# + and a.userno <> #usernonot# and a.usertype in ($usertypes$) and a.usertype =#usertype# @@ -272,6 +272,7 @@ a.usertype > #usertypeover# a.vssn = #vssn# + a.di = #di# ) a order by a.rno diff --git a/FO/Controllers/AccountController.cs b/FO/Controllers/AccountController.cs index e9500d0..3bf1cb7 100644 --- a/FO/Controllers/AccountController.cs +++ b/FO/Controllers/AccountController.cs @@ -509,7 +509,7 @@ namespace NP.FO.Controllers RETURN_URL = GetConfig("fronturl") + "/Account/CertOk3" + sel + "?reason=" + reason + (!string.IsNullOrEmpty(param1) ? "¶m1=" + param1 : "") + (!string.IsNullOrEmpty(param2) ? "¶m2=" + param2 : ""); RTN_URL = GetConfig("fronturl") + "/Account/CertOk3" + sel + "?reason=" + reason + (!string.IsNullOrEmpty(param1) ? "¶m1=" + param1 : "") + (!string.IsNullOrEmpty(param2) ? "¶m2=" + param2 : ""); //모바일팝업 - if (sel == "MOBI" || sel == "MCHK") + if (sel == "MOBI") { license = "C:\\Windows\\SysWOW64\\" + CP_CD + "_IDS_01_" + target + "_AES_license.dat"; svcName = "IDS_HS_POPUP_START"; @@ -653,17 +653,54 @@ namespace NP.FO.Controllers RSLT_CD = "U000"; RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; } + else + { + IList chk2 = Dao.Get("users.users", new System.Collections.Hashtable() { { "di", DI } }); + if (chk2.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 인증정보로 등록된 회원이 존재합니다."; + } + } } else if (reason == "AuthPlatformChange") { - if (SUserInfo.UserNo > 0) + var user = Dao.Get("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault(); + if (user != null) { - //정보수정시 본인제외 체크를 위해 usernonot추가 - IList chk = Dao.Get("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } }); - if (chk.Count() > 0) + if (string.IsNullOrEmpty(user.di)) { - RSLT_CD = "U000"; - RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; + //정보수정시 본인제외 체크를 위해 usernonot추가 + IList chk = Dao.Get("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } }); + if (chk.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; + } + else + { + IList chk2 = Dao.Get("users.users", new System.Collections.Hashtable() { { "di", DI }, { "usernonot", SUserInfo.UserNo } }); + if (chk2.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 인증정보로 등록된 회원이 존재합니다."; + } + } + } + else if (user.di == DI) + { + //정보수정시 본인제외 체크를 위해 usernonot추가 + IList chk = Dao.Get("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } }); + if (chk.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; + } + } + else + { + RSLT_CD = "U002"; + RSLT_MSG = "인증정보가 등록된 회원 인증정보와 일치하지 않습니다."; } } else @@ -674,14 +711,42 @@ namespace NP.FO.Controllers } else if (reason == "MobileNumberChange") { - if (SUserInfo.UserNo > 0) + var user = Dao.Get("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault(); + if (user != null) { - //정보수정시 본인제외 체크를 위해 usernonot추가 - IList chk = Dao.Get("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } }); - if (chk.Count() > 0) + if (string.IsNullOrEmpty(user.di)) { - RSLT_CD = "U000"; - RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; + //정보수정시 본인제외 체크를 위해 usernonot추가 + IList chk = Dao.Get("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } }); + if (chk.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; + } + else + { + IList chk2 = Dao.Get("users.users", new System.Collections.Hashtable() { { "di", DI }, { "usernonot", SUserInfo.UserNo } }); + if (chk2.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 인증정보로 등록된 회원이 존재합니다."; + } + } + } + else if (user.di == DI) + { + //정보수정시 본인제외 체크를 위해 usernonot추가 + IList chk = Dao.Get("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } }); + if (chk.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; + } + } + else + { + RSLT_CD = "U002"; + RSLT_MSG = "인증정보가 등록된 회원 인증정보와 일치하지 않습니다."; } } else @@ -790,17 +855,54 @@ namespace NP.FO.Controllers RSLT_CD = "U000"; RSLT_MSG = "이미 해당 ipin으로 등록된 회원이 존재합니다."; } + else + { + IList chk2 = Dao.Get("users.users", new System.Collections.Hashtable() { { "di", DI } }); + if (chk2.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 인증정보로 등록된 회원이 존재합니다."; + } + } } else if (reason == "AuthPlatformChange") { - if (SUserInfo.UserNo > 0) + var user = Dao.Get("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault(); + if (user != null) { - //정보수정시 본인제외 체크를 위해 usernonot추가 - IList chk = Dao.Get("users.users", new System.Collections.Hashtable() { { "vssn", VSSN }, { "usernonot", SUserInfo.UserNo } }); - if (chk.Count() > 0) + if (string.IsNullOrEmpty(user.di)) { - RSLT_CD = "U000"; - RSLT_MSG = "이미 해당 ipin으로 등록된 회원이 존재합니다."; + //정보수정시 본인제외 체크를 위해 usernonot추가 + IList chk = Dao.Get("users.users", new System.Collections.Hashtable() { { "vssn", VSSN }, { "usernonot", SUserInfo.UserNo } }); + if (chk.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 ipin으로 등록된 회원이 존재합니다."; + } + else + { + IList chk2 = Dao.Get("users.users", new System.Collections.Hashtable() { { "di", DI }, { "usernonot", SUserInfo.UserNo } }); + if (chk2.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 인증정보로 등록된 회원이 존재합니다."; + } + } + } + else if (user.di == DI) + { + //정보수정시 본인제외 체크를 위해 usernonot추가 + IList chk = Dao.Get("users.users", new System.Collections.Hashtable() { { "vssn", VSSN }, { "usernonot", SUserInfo.UserNo } }); + if (chk.Count() > 0) + { + RSLT_CD = "U000"; + RSLT_MSG = "이미 해당 ipin으로 등록된 회원이 존재합니다."; + } + } + else + { + RSLT_CD = "U002"; + RSLT_MSG = "인증정보가 등록된 회원 인증정보와 일치하지 않습니다."; } } else @@ -811,17 +913,20 @@ namespace NP.FO.Controllers } else if (reason == "LectinningAuth") { - if (SUserInfo.UserNo > 0) + var user = Dao.Get("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault(); + if (user != null) { - - if(long.TryParse(param1, out long lectno)) + if (string.IsNullOrEmpty(user.di) || user.di == DI) { - if (long.TryParse(param2, out long cmino)) + + if (long.TryParse(param1, out long lectno)) { - var lectInnings = Dao.Get("cr.cminnings", new System.Collections.Hashtable() { { "lectno", lectno }, { "userno", SUserInfo.UserNo } }); - if (lectInnings.Where(w => w.cmino == cmino).Count() > 0) + if (long.TryParse(param2, out long cmino)) { - var Hashtable = new System.Collections.Hashtable() { + var lectInnings = Dao.Get("cr.cminnings", new System.Collections.Hashtable() { { "lectno", lectno }, { "userno", SUserInfo.UserNo } }); + if (lectInnings.Where(w => w.cmino == cmino).Count() > 0) + { + var Hashtable = new System.Collections.Hashtable() { { "lectno", lectno }, { "cmino", cmino }, { "isattcheck", 1 }, @@ -829,9 +934,15 @@ namespace NP.FO.Controllers { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }; - Dao.Save("lect.lectinning.isatt.in", Hashtable); - ViewBag.lectno = lectno; - ViewBag.cmino = cmino; + Dao.Save("lect.lectinning.isatt.in", Hashtable); + ViewBag.lectno = lectno; + ViewBag.cmino = cmino; + } + else + { + RSLT_CD = "U998"; + RSLT_MSG = "cmino 에러"; + } } else { @@ -842,13 +953,13 @@ namespace NP.FO.Controllers else { RSLT_CD = "U998"; - RSLT_MSG = "cmino 에러"; + RSLT_MSG = "lectno 에러"; } } else { - RSLT_CD = "U998"; - RSLT_MSG = "lectno 에러"; + RSLT_CD = "U002"; + RSLT_MSG = "인증정보가 등록된 회원 인증정보와 일치하지 않습니다."; } } else diff --git a/FO/Controllers/CDMSController.cs b/FO/Controllers/CDMSController.cs index 2583739..d9576eb 100644 --- a/FO/Controllers/CDMSController.cs +++ b/FO/Controllers/CDMSController.cs @@ -80,7 +80,7 @@ namespace NP.FO.Controllers if (SUserInfo.UserNo > 0 && vm.cmino > 0 && vm.lectno > 0) { var data = Dao.Get("lect.lectinning.attcert.check", new Hashtable() { { "lectno", vm.lectno }, { "cmino", vm.cmino }, { "userno", SUserInfo.UserNo } }).FirstOrDefault(); - //intval 회차intval2 출석인증제외 회원, intval3 출석인증제외 강좌 + //출석 인증 시만 보이게 제한 처리 (intval 회차, intval2 출석인증제외 회원, intval3 출석인증제외 강좌) if (data != null && (data.intval == 1 || data.intval2 == 1 || data.intval3 == 1)) { //이어보기를 위해 페이지관리 diff --git a/FO/Views/Account/CertOk3IPIN.cshtml b/FO/Views/Account/CertOk3IPIN.cshtml index 1b5fdef..9d4158a 100644 --- a/FO/Views/Account/CertOk3IPIN.cshtml +++ b/FO/Views/Account/CertOk3IPIN.cshtml @@ -38,7 +38,7 @@ self.close(); } else if (ViewBag.reason == "AuthPlatformChange") { - + if ("@(RSLT_NAME)" == $(opener.document).find("#mform").find("#username").val()) { $(opener.document).find("#mform").find("#authplatform").val("@(AuthPlatform.IPIN.GetHashCode())"); $(opener.document).find("#mform").find("#birthday").val("@(RSLT_BIRTHDAY)"); diff --git a/FO/Views/Account/CertOk3MOBI.cshtml b/FO/Views/Account/CertOk3MOBI.cshtml index 31c42c7..6c51a45 100644 --- a/FO/Views/Account/CertOk3MOBI.cshtml +++ b/FO/Views/Account/CertOk3MOBI.cshtml @@ -40,8 +40,8 @@ self.close(); } else if (ViewBag.reason == "MobileNumberChange") { - - if ("@(RSLT_NAME)" == $(opener.document).find("#mform").find("#username").val()) { + + if ("@(RSLT_NAME)" == $(opener.document).find("#mform").find("#username").val()) { $(opener.document).find("#mform").find("#mobile").val("@(TEL_NO)".replaceAll("-", "")); $(opener.document).find("#mform").find("#mobilestr").text("@(TEL_NO)".replaceAll("-", "")); alert("인증완료"); @@ -53,8 +53,8 @@ self.close(); } else if (ViewBag.reason == "AuthPlatformChange") { - - if ("@(RSLT_NAME)" == $(opener.document).find("#mform").find("#username").val()) { + + if ("@(RSLT_NAME)" == $(opener.document).find("#mform").find("#username").val()) { $(opener.document).find("#mform").find("#authplatform").val("@(AuthPlatform.Mobile.GetHashCode())"); $(opener.document).find("#mform").find("#authPlatform_IPIN").hide(); $(opener.document).find("#mform").find("#authPlatform_Mobile").show();