로그인 로직 변경.

비밀번호 변경 로직 변경.
main
강석 최 2024-05-08 16:28:40 +09:00
parent 31d2c14f20
commit 6a265de2b4
6 changed files with 83 additions and 21 deletions

View File

@ -29,8 +29,8 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="D:/app_geoinfo/app/eclipse/workspace/geoinfo_admin/src/main/webapp/WEB-INF/lib/ClipReport4.0-1.0.0.301.jar"/>
<classpathentry kind="lib" path="D:/app_geoinfo/app/eclipse/workspace/geoinfo_admin/src/main/webapp/WEB-INF/lib/ClipReport4.0-Common.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/ClipReport4.0-1.0.0.301.jar"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/ClipReport4.0-Common.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.5"/>
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/classes"/>
<classpathentry kind="output" path="target/classes"/>

View File

@ -103,8 +103,15 @@ public class MainController {
params.put("id", id);
params.put("ipAdd", ipAdd);
String strAccessAllows = "[" + "{\"ip\":\"218.49.16.78\", \"id\":\"admin_user\"}, " + "{\"ip\":\"0:0:0:0:0:0:0:1\", \"id\":\"admin_user\"}, "+
"{\"ip\":\"218.49.21.65\",\"id\":\"admin_user\"}, " + "{\"ip\":\"218.49.21.65\",\"id\":\"sogone\"}, " + "{\"ip\":\"218.232.234.161\",\"id\":\"admin_user\"} " +"]";
/*
String strAccessAllows =
"[" +
"{\"ip\":\"218.49.16.78\", \"id\":\"admin_user\"}, " +
"{\"ip\":\"0:0:0:0:0:0:0:1\", \"id\":\"admin_user\"}, "+
"{\"ip\":\"218.49.21.65\",\"id\":\"admin_user\"}, " +
"{\"ip\":\"218.49.21.65\",\"id\":\"sogone\"}, " +
"{\"ip\":\"218.232.234.161\",\"id\":\"admin_user\"} " +
"]";
JSONArray jsonArray = new JSONArray(strAccessAllows);
@ -120,7 +127,6 @@ public class MainController {
isAuth = false;
}
}
if (isAuth) {
String encryptChk = mainService.encryptChk(params);
@ -147,6 +153,45 @@ public class MainController {
mainService.insertAccessLog(params);
}
}
*/
String[] allowIp = {"0:0:0:0:0:0:0:1", "218.49.16.78", "218.49.21.65", "218.232.234.161"};
boolean isAuth = false;
boolean encryptChange = true;
boolean loginSuccess = false;
String encryptChk = mainService.encryptChk(params);
if (encryptChk == null || ("").equals(encryptChk)) {
encryptChange = false;
}
if (encryptChange) {
params.put("pw", admin_passwd);
} else {
params.put("pw", admin_pass);
}
EgovMap getMemberInfo = mainService.getMemberInfo(params);
if (getMemberInfo != null) {
if(getMemberInfo.get("cls").toString().equals("9")) {
for(String ip : allowIp) {
if(ip.equals(ipAdd)) {
isAuth = true;
}
}
if(isAuth) {
loginSuccess = true;
UserInfo.setSession(request, id.trim(), getMemberInfo.get("userName").toString(), "", "admin");
if (!encryptChange) {
params.put("pw", admin_passwd);
mainService.updateEncrypt(params);
}
mainService.insertAccessLog(params);
}
}
}
HashMap<String, Object> jsonMap = new HashMap<String, Object>();
jsonMap.put("isAuth", isAuth);

View File

@ -41,14 +41,21 @@ public class AdminInfoMngController {
} else {
int affectRow = 0;
params.put("id", "admin_user");
//params.put("id", "admin_user");
EgovMap result = masterService.getMember(params);
try {
if (result != null) {
affectRow = 1;
masterService.updateInfo(params);
if (result == null) {
affectRow = -1;
}else if (result != null) {
String dbpw = result.get("passwd").toString();
String inputpw = params.get("old_pass").toString();
boolean pwFlag = dbpw.equals(inputpw);
if(pwFlag) {
affectRow = 1;
masterService.updateInfo(params);
}
}
jsonMap.put("affectRow", affectRow);

View File

@ -15,7 +15,8 @@
<![CDATA[
SELECT USERID,
USER_NAME,
PASSWD
PASSWD,
CLS
FROM WEB_MEMBER_IN
WHERE TRIM(USERID) = #{id}
AND TRIM(PASSWD) = #{pw}

View File

@ -7,7 +7,6 @@
<![CDATA[
SELECT * FROM WEB_MEMBER_IN
WHERE TRIM(USERID)=#{id}
AND PASSWD=#{old_pass}
]]>
</select>

View File

@ -13,6 +13,12 @@
<script>
function pass_change(){
if ($("#id").val() == "") {
alert("아이디를 입력해주세요.");
$("#id").focus();
return;
}
if ($("#old_pass").val() == "") {
alert("현재 비밀번호를 입력해주세요.");
$("#old_pass").focus();
@ -36,7 +42,11 @@ function pass_change(){
async : false,
success : function(json){
if (json.flag) {
if (json.affectRow == 0) {
if (json.affectRow == -1) {
alert("아이디가 존재하지 않습니다");
$("#old_pass").val("");
// $("#new_pass").val("");
}else if (json.affectRow == 0) {
alert("현재 비밀번호가 맞지않습니다");
$("#old_pass").val("");
// $("#new_pass").val("");
@ -82,25 +92,25 @@ function pass_change(){
<td colspan=2 align=center>
<table id="Table_01" width=557 height=200 border=0 cellpadding=0 cellspacing=0 background="${pageContext.request.contextPath}/images/admins/manager/login_img.jpg">
<tr>
<td width=557 height=69 colspan=4>&nbsp;</td>
<td height=50 colspan=3></td>
</tr>
<tr>
<td width=254 height=31 align=right><font size=2 color="black" face="굴림체"><b>현재 비밀번호</b></font></td>
<td width=174 height=31><input type="password" id="old_pass" name="old_pass" size=25></td>
<td width=89 height=78 rowspan=3>
<input type="image" src="${pageContext.request.contextPath}/images/admins/manager/6_btn_ok.gif" onclick="javascript:pass_change()">
<td width=254 height=11 align=right><font size=2 color="black" face="굴림체"><b>아이디</b></font></td>
<td width=174 height=11><input type="text" id="id" name="id" size=25></td>
<td width=89 height=33 rowspan=3>
<input type="image" src="${pageContext.request.contextPath}/images/admins/manager/6_btn_ok.gif" onclick="javascript:pass_change()">
</td>
<td width=40 height=78 rowspan=3>&nbsp;</td>
</tr>
<tr>
<td width=428 height=16 colspan=2>&nbsp;</td>
<td width=254 height=11 align=right><font size=2 color="black" face="굴림체"><b>현재 비밀번호</b></font></td>
<td width=174 height=11><input type="password" id="old_pass" name="old_pass" size=25></td>
</tr>
<tr>
<td width=254 height=31 align=right><font size=2 color="black" face="굴림체"><b>새 비밀번호</b></font></td>
<td width=254 height=11 align=right><font size=2 color="black" face="굴림체"><b>새 비밀번호</b></font></td>
<td><input type="password" id="new_pass" name="new_pass" size=25></td>
</tr>
<tr>
<td width=557 height=53 colspan=4>&nbsp;</td>
<td height=50 colspan=3></td>
</tr>
</table>
</td>