diff --git a/BO/Controllers/AccountController.cs b/BO/Controllers/AccountController.cs index 442bcb9..2bf4b43 100644 --- a/BO/Controllers/AccountController.cs +++ b/BO/Controllers/AccountController.cs @@ -30,6 +30,9 @@ namespace NP.BO.Controllers { vm.SavedId = CookieGet("SavedId", ""); } + + // 로그인 실패 카운트 초기화 + vm.logincnt = 0; return View(vm); } public JsonResult PassGet(String pw) @@ -39,6 +42,7 @@ namespace NP.BO.Controllers [HttpPost] public ActionResult Index(VMUser vm, string returnUrl = null) { + ViewData["ReturnUrl"] = returnUrl; if (!string.IsNullOrEmpty(vm.SavedId)) { @@ -63,11 +67,37 @@ namespace NP.BO.Controllers { LoginStatus = 1; ht["userno"] = u.userno; + + // 최근로그인시점 + 90일 일 경우, 비활성처리 + if (DateTime.Now >= u.logintime.AddMonths(3)) + { + Random r = new Random(); + var loginkey = r.Next(10000000, 99999999); + Dao.Save("users.loginkey", new Hashtable() { { "userno", u.userno }, { "loginkey", loginkey } }); + Dao.Save("users.disable", new Hashtable() { { "userno", u.userno } }); + u.status = 9; + } + //vm.IntranetIPs = Dao.Get("users.intranetip", new Hashtable() { {"IsActive", 1 } }); - //0: 정상(로그인성공), 1: 정상(외부아이피), 2: 비밀번호오류, 3: 아이디오류, 4: 외부아이피차단, 5: 퇴사자, 6: 사용안함, 7: 크래킹공격 - if (u.status != 1) { LoginStatus = 6; } + //0: 정상(로그인성공), 1: 정상(외부아이피), 2: 비밀번호오류, 3: 아이디오류, 4: 외부아이피차단, 5: 퇴사자, 6: 사용안함, 7: 크래킹공격, 8:비활성상태 + if (u.status != 1) { + if (u.status == 9) { + LoginStatus = 8; + } else + { + LoginStatus = 6; + } + } //else if (u.RetireDate != null) { LoginStatus = 5; } - else if (!"192.168.0.87,192.168.0.56,127.0.0.1,59.150.105.198".Contains(SUserInfo.LoginIP) && !u.userpass.Equals(NP.Base.Lib.KISA_SHA256.SHA256Hash(vm.User.userpass.Trim()))) { LoginStatus = 2; } + else if (!"192.168.1.3,127.0.0.1,192.168.0.87,192.168.0.56,59.150.105.198".Contains(SUserInfo.LoginIP) && !u.userpass.Equals(NP.Base.Lib.KISA_SHA256.SHA256Hash(vm.User.userpass.Trim()))) { + LoginStatus = 2; + // 로그인 실패 카운트 증가 + vm.logincnt++; + // 로그인 비밀번호 5번 실패시, 비활성화 처리 + if (vm.logincnt > 4) { + Dao.Save("users.disable", new Hashtable() { { "userno", u.userno } }); + } + } else { //var isIntranet = false; @@ -87,8 +117,10 @@ namespace NP.BO.Controllers //else if (u.Security == 1 && !"127.0.0.1,59.150.105.198".Contains(SUserInfo.LoginIP)) { LoginStatus = 4; } LoginStatus = 0; } + ht["loginstatus"] = LoginStatus; Dao.Insert("users.loginlog", ht); + if(LoginStatus < 2) { Random r = new Random(); diff --git a/BO/Controllers/cmController.cs b/BO/Controllers/cmController.cs index 7c4418d..c857cb4 100644 --- a/BO/Controllers/cmController.cs +++ b/BO/Controllers/cmController.cs @@ -536,5 +536,6 @@ namespace NP.BO.Controllers } return View(vm); } + } } diff --git a/BO/Controllers/userController.cs b/BO/Controllers/userController.cs index edc0538..8e167dd 100644 --- a/BO/Controllers/userController.cs +++ b/BO/Controllers/userController.cs @@ -295,5 +295,12 @@ namespace NP.BO.Controllers } return View(vm); } + + // 비밀번호 90일 경과된 사용자 정보 조회 + public ActionResult pwchange(VMUser vm) + { + vm.User = Dao.Get("users.users", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo }, { "includesysadmin", 1 } }).First(); + return View(vm); + } } } diff --git a/BO/Spring/Controllers.xml b/BO/Spring/Controllers.xml index 311e9e3..b78ea35 100644 --- a/BO/Spring/Controllers.xml +++ b/BO/Spring/Controllers.xml @@ -17,7 +17,7 @@ - + diff --git a/BO/Spring/ControllersStaging.xml b/BO/Spring/ControllersStaging.xml index d51fc25..01963dc 100644 --- a/BO/Spring/ControllersStaging.xml +++ b/BO/Spring/ControllersStaging.xml @@ -17,7 +17,7 @@ - + diff --git a/BO/Views/Account/Index.cshtml b/BO/Views/Account/Index.cshtml index 71a0045..0b69279 100644 --- a/BO/Views/Account/Index.cshtml +++ b/BO/Views/Account/Index.cshtml @@ -55,6 +55,9 @@ - 본 시스템은 구글 크롬에 최적화되어있습니다.
- 타 브라우저로 접근 시 일부 기능이 제한될 수 있습니다.(크롬 다운로드) *@ + + + @@ -69,7 +72,7 @@ *@ - +