인증 DI 중복체크 로직 추가

This commit is contained in:
lch 2021-06-09 05:29:52 +00:00
parent d2048fbbe1
commit 1845e4274c
6 changed files with 185 additions and 65 deletions

View File

@ -102,35 +102,43 @@ namespace NP.Base.Controllers
[HttpPost] [HttpPost]
public JsonResult UserSave(Users u) public JsonResult UserSave(Users u)
{ {
u.userno = SUserInfo.UserNo; var user = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault();
u.uno = SUserInfo.UserNo; if (user != null)
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<int>("users.checkuser", new Hashtable() { { "usernonot", SUserInfo.UserNo }, { "email", u.email },{"mobile",u.mobile } }).First();
if (check < 9)
{ {
return JsonOK(check * -1); if (string.IsNullOrEmpty(user.di) || user.di == u.di)
}
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; u.userno = SUserInfo.UserNo;
AuthCookie(true); 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<int>("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] [HttpPost]
public JsonResult UserExit(String exitreason) public JsonResult UserExit(String exitreason)

View File

@ -238,7 +238,7 @@
,case when c.refcode='9' then a.ccpositionetc else c.cname end ccpositionname ,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 ,case when a.usertype=1 then '교육생' when d.authname is null then '-' else d.authname end usertypestr
,CAST(AES_DECRYPT(UNHEX(a.birthday), <include refid="sql.digest"></include>) AS char) birthday ,CAST(AES_DECRYPT(UNHEX(a.birthday), <include refid="sql.digest"></include>) 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 <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.username</isNull>) rno ,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.username</isNull>) rno
,count(a.cdt) over() pagetotalcount ,count(a.cdt) over() pagetotalcount
from users a from users a
@ -252,7 +252,7 @@
<isNull property="includesysadmin">and a.usertype &lt;&gt; 91</isNull> <isNull property="includesysadmin">and a.usertype &lt;&gt; 91</isNull>
<isNotNull property="userno">and a.userno =#userno#</isNotNull> <isNotNull property="userno">and a.userno =#userno#</isNotNull>
<isNotNull property="usernonot"> <isNotNull property="usernonot">
<isGreaterThan property="usernonot" compareValue="0">and a.userno &lt;&gt; #userno#</isGreaterThan> <isGreaterThan property="usernonot" compareValue="0">and a.userno &lt;&gt; #usernonot#</isGreaterThan>
</isNotNull> </isNotNull>
<isNotEmpty property="usertypes">and a.usertype in ($usertypes$)</isNotEmpty> <isNotEmpty property="usertypes">and a.usertype in ($usertypes$)</isNotEmpty>
<isNotNull property="usertype">and a.usertype =#usertype#</isNotNull> <isNotNull property="usertype">and a.usertype =#usertype#</isNotNull>
@ -272,6 +272,7 @@
</isNotEmpty> </isNotEmpty>
<isNotNull property="usertypeover" prepend="and">a.usertype &gt; #usertypeover#</isNotNull> <isNotNull property="usertypeover" prepend="and">a.usertype &gt; #usertypeover#</isNotNull>
<isNotNull property="vssn" prepend="and">a.vssn = #vssn#</isNotNull> <isNotNull property="vssn" prepend="and">a.vssn = #vssn#</isNotNull>
<isNotNull property="di" prepend="and">a.di = #di#</isNotNull>
) a ) a
<include refid="sql.pagedynamic"></include> <include refid="sql.pagedynamic"></include>
order by a.rno order by a.rno

View File

@ -509,7 +509,7 @@ namespace NP.FO.Controllers
RETURN_URL = GetConfig("fronturl") + "/Account/CertOk3" + sel + "?reason=" + reason + (!string.IsNullOrEmpty(param1) ? "&param1=" + param1 : "") + (!string.IsNullOrEmpty(param2) ? "&param2=" + param2 : ""); RETURN_URL = GetConfig("fronturl") + "/Account/CertOk3" + sel + "?reason=" + reason + (!string.IsNullOrEmpty(param1) ? "&param1=" + param1 : "") + (!string.IsNullOrEmpty(param2) ? "&param2=" + param2 : "");
RTN_URL = GetConfig("fronturl") + "/Account/CertOk3" + sel + "?reason=" + reason + (!string.IsNullOrEmpty(param1) ? "&param1=" + param1 : "") + (!string.IsNullOrEmpty(param2) ? "&param2=" + param2 : ""); RTN_URL = GetConfig("fronturl") + "/Account/CertOk3" + sel + "?reason=" + reason + (!string.IsNullOrEmpty(param1) ? "&param1=" + param1 : "") + (!string.IsNullOrEmpty(param2) ? "&param2=" + param2 : "");
//모바일팝업 //모바일팝업
if (sel == "MOBI" || sel == "MCHK") if (sel == "MOBI")
{ {
license = "C:\\Windows\\SysWOW64\\" + CP_CD + "_IDS_01_" + target + "_AES_license.dat"; license = "C:\\Windows\\SysWOW64\\" + CP_CD + "_IDS_01_" + target + "_AES_license.dat";
svcName = "IDS_HS_POPUP_START"; svcName = "IDS_HS_POPUP_START";
@ -653,17 +653,54 @@ namespace NP.FO.Controllers
RSLT_CD = "U000"; RSLT_CD = "U000";
RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다.";
} }
else
{
IList<Users> chk2 = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "di", DI } });
if (chk2.Count() > 0)
{
RSLT_CD = "U000";
RSLT_MSG = "이미 해당 인증정보로 등록된 회원이 존재합니다.";
}
}
} }
else if (reason == "AuthPlatformChange") else if (reason == "AuthPlatformChange")
{ {
if (SUserInfo.UserNo > 0) var user = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault();
if (user != null)
{ {
//정보수정시 본인제외 체크를 위해 usernonot추가 if (string.IsNullOrEmpty(user.di))
IList<Users> chk = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } });
if (chk.Count() > 0)
{ {
RSLT_CD = "U000"; //정보수정시 본인제외 체크를 위해 usernonot추가
RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; IList<Users> chk = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } });
if (chk.Count() > 0)
{
RSLT_CD = "U000";
RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다.";
}
else
{
IList<Users> chk2 = Dao.Get<Users>("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<Users> chk = Dao.Get<Users>("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 else
@ -674,14 +711,42 @@ namespace NP.FO.Controllers
} }
else if (reason == "MobileNumberChange") else if (reason == "MobileNumberChange")
{ {
if (SUserInfo.UserNo > 0) var user = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault();
if (user != null)
{ {
//정보수정시 본인제외 체크를 위해 usernonot추가 if (string.IsNullOrEmpty(user.di))
IList<Users> chk = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } });
if (chk.Count() > 0)
{ {
RSLT_CD = "U000"; //정보수정시 본인제외 체크를 위해 usernonot추가
RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다."; IList<Users> chk = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "mobile", TEL_NO }, { "usernonot", SUserInfo.UserNo } });
if (chk.Count() > 0)
{
RSLT_CD = "U000";
RSLT_MSG = "이미 해당 휴대폰번호로 등록된 회원이 존재합니다.";
}
else
{
IList<Users> chk2 = Dao.Get<Users>("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<Users> chk = Dao.Get<Users>("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 else
@ -790,17 +855,54 @@ namespace NP.FO.Controllers
RSLT_CD = "U000"; RSLT_CD = "U000";
RSLT_MSG = "이미 해당 ipin으로 등록된 회원이 존재합니다."; RSLT_MSG = "이미 해당 ipin으로 등록된 회원이 존재합니다.";
} }
else
{
IList<Users> chk2 = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "di", DI } });
if (chk2.Count() > 0)
{
RSLT_CD = "U000";
RSLT_MSG = "이미 해당 인증정보로 등록된 회원이 존재합니다.";
}
}
} }
else if (reason == "AuthPlatformChange") else if (reason == "AuthPlatformChange")
{ {
if (SUserInfo.UserNo > 0) var user = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault();
if (user != null)
{ {
//정보수정시 본인제외 체크를 위해 usernonot추가 if (string.IsNullOrEmpty(user.di))
IList<Users> chk = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "vssn", VSSN }, { "usernonot", SUserInfo.UserNo } });
if (chk.Count() > 0)
{ {
RSLT_CD = "U000"; //정보수정시 본인제외 체크를 위해 usernonot추가
RSLT_MSG = "이미 해당 ipin으로 등록된 회원이 존재합니다."; IList<Users> chk = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "vssn", VSSN }, { "usernonot", SUserInfo.UserNo } });
if (chk.Count() > 0)
{
RSLT_CD = "U000";
RSLT_MSG = "이미 해당 ipin으로 등록된 회원이 존재합니다.";
}
else
{
IList<Users> chk2 = Dao.Get<Users>("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<Users> chk = Dao.Get<Users>("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 else
@ -811,17 +913,20 @@ namespace NP.FO.Controllers
} }
else if (reason == "LectinningAuth") else if (reason == "LectinningAuth")
{ {
if (SUserInfo.UserNo > 0) var user = Dao.Get<Users>("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo } }).FirstOrDefault();
if (user != null)
{ {
if (string.IsNullOrEmpty(user.di) || user.di == DI)
if(long.TryParse(param1, out long lectno))
{ {
if (long.TryParse(param2, out long cmino))
if (long.TryParse(param1, out long lectno))
{ {
var lectInnings = Dao.Get<LectInning>("cr.cminnings", new System.Collections.Hashtable() { { "lectno", lectno }, { "userno", SUserInfo.UserNo } }); if (long.TryParse(param2, out long cmino))
if (lectInnings.Where(w => w.cmino == cmino).Count() > 0)
{ {
var Hashtable = new System.Collections.Hashtable() { var lectInnings = Dao.Get<LectInning>("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 }, { "lectno", lectno },
{ "cmino", cmino }, { "cmino", cmino },
{ "isattcheck", 1 }, { "isattcheck", 1 },
@ -829,9 +934,15 @@ namespace NP.FO.Controllers
{ "uno", SUserInfo.UserNo }, { "uno", SUserInfo.UserNo },
{ "uip", GetUserIP() } { "uip", GetUserIP() }
}; };
Dao.Save("lect.lectinning.isatt.in", Hashtable); Dao.Save("lect.lectinning.isatt.in", Hashtable);
ViewBag.lectno = lectno; ViewBag.lectno = lectno;
ViewBag.cmino = cmino; ViewBag.cmino = cmino;
}
else
{
RSLT_CD = "U998";
RSLT_MSG = "cmino 에러";
}
} }
else else
{ {
@ -842,13 +953,13 @@ namespace NP.FO.Controllers
else else
{ {
RSLT_CD = "U998"; RSLT_CD = "U998";
RSLT_MSG = "cmino 에러"; RSLT_MSG = "lectno 에러";
} }
} }
else else
{ {
RSLT_CD = "U998"; RSLT_CD = "U002";
RSLT_MSG = "lectno 에러"; RSLT_MSG = "인증정보가 등록된 회원 인증정보와 일치하지 않습니다.";
} }
} }
else else

View File

@ -80,7 +80,7 @@ namespace NP.FO.Controllers
if (SUserInfo.UserNo > 0 && vm.cmino > 0 && vm.lectno > 0) if (SUserInfo.UserNo > 0 && vm.cmino > 0 && vm.lectno > 0)
{ {
var data = Dao.Get<Data>("lect.lectinning.attcert.check", new Hashtable() { { "lectno", vm.lectno }, { "cmino", vm.cmino }, { "userno", SUserInfo.UserNo } }).FirstOrDefault(); var data = Dao.Get<Data>("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)) if (data != null && (data.intval == 1 || data.intval2 == 1 || data.intval3 == 1))
{ {
//이어보기를 위해 페이지관리 //이어보기를 위해 페이지관리