로그인화면에 기관,사용자아이디 저장 기능 추가

main
이범준 5 months ago
parent 30853541ff
commit fd5c5de8af

@ -31,7 +31,10 @@ public class MainController extends cokr.xit.base.web.MainController {
@Override
public ModelAndView loginPage() {
return new ModelAndView("login");
ModelAndView mav = new ModelAndView("login");
List<DataObject> instList = fimsOgdpBean.selectAllInstList();
mav.addObject("instList", instList);
return mav;
}
@Override

@ -54,8 +54,14 @@
<form id="formAuthentication" method="post">
<div class="input_wrap">
<div class="input-group">
<select id="institute" name="institute" class="form-select mb-2 h-px-40 no-max-w">
<option value="default">기본</option>
<select id="institute" name="institute" required title="기관명" class="form-select mb-2 h-px-40 no-max-w">
<option value="">[기관 선택]</option>
<option value="default">시스템관리</option>
<c:forEach items="${instList}" var="item">
<option value="${item.INST_CD}"
<c:if test="${item.USER_USE_YN == 'N'}"> disabled </c:if>
>${item.INST_NM}</option>
</c:forEach>
</select>
</div>
<div class="input-group">
@ -66,6 +72,10 @@
<input type="password" id="password"
required title="비밀번호 입력" class="typePassword required form-control inp-long" placeholder="비밀번호" autocomplete="false" />
<span class="input-group-text cursor-pointer"><i class="bx bxs-lock"></i></span>
</div>
<div class="mt-3 form-chcek">
<input id="remember" type="checkbox" class="form-check-input">
<label class="form-check-label">로그인 정보 유지</label>
</div>
<div class="input_wrap2">
<!--
@ -88,24 +98,26 @@
<template id="selectInstDialogTemplate">
<select class="form-select form-control-sm" id="selectInst">
<option value="">선택</option>
<c:forEach items="${instList}" var="item">
<option value="${item.INST_CD}">${item.INST_NM}</option>
</c:forEach>
</select>
</template>
<jsp:include page="/WEB-INF/jsp/include/tail.jsp" />
<script type="text/javascript">
var INST_LIST = [];
${functions}
function login() {
if (!$("#formAuthentication input").validInputs()) return;
if (!$("#formAuthentication input,select").validInputs()) return;
var params = {
account:$("#userId").val(),
password:$("#password").val(),
institute:$("#institute").val()
<%--, rememberCredentials:true--%>
institute:$("#institute").val(),
rememberCredentials: $("#remember").prop("checked")
};
json.post({
@ -154,11 +166,6 @@ function fnOpenSignup(){
content : document.getElementById("selectInstDialogTemplate").innerHTML,
size : "sm",
init : () => {
var options = "";
for(var i=0; i < INST_LIST.length; i++){
options += "<option value='"+INST_LIST[i].INST_CD+"'>"+INST_LIST[i].INST_NM+"</option>";
}
$("#selectInst").append(options);
},
onOK : () => {
if($("#selectInst").val() == ""){
@ -205,24 +212,35 @@ function fn_FindPw(){
$(function(){
$("#formAuthentication input").onEnterPress(login);
if ($("#userId").val())
$("#password").focus();
ajax.get({
url : wctx.url("/instList.do"),
data : { },
success : (resp) => {
INST_LIST = resp.instList;
var options = "";
for(var i=0; i < INST_LIST.length; i++){
options += "<option value='"+INST_LIST[i].INST_CD+"'>"+INST_LIST[i].INST_NM+"</option>";
let sysInst = "<%= systemInst %>";
let cookieInst = "${cookie['userInstitute'].getValue()}";
let cookieUserId = "${cookie['userAccount'].getValue()}";
let hasCookie = (cookieInst != "" && cookieUserId != "");
let selectValue = "";
let isSelectable = false;
if(hasCookie){
selectValue = cookieInst;
isSelectable = $("#institute option[value='"+selectValue+"']").not("[disabled]").length;
if(isSelectable){
$("#institute").val(cookieInst);
$("#userId").val(cookieUserId);
$("#remember").prop("checked", true);
$("#password").focus();
return;
}
}
$("#institute").append(options);
$("#institute").val(<%= systemInst %>);
selectValue = sysInst;
isSelectable = $("#institute option[value='"+selectValue+"']").not("[disabled]").length;
if(isSelectable){
$("#institute").val(selectValue);
$("#userId").focus();
} else {
$("#institute").focus();
}
});
});
</script>

Loading…
Cancel
Save