123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- var CookieID = "etecebid_loginid";
- /**
- * 로그인 처리후 Forward 될 URI
- * sign_on.jsp에서 call
- */
- var forward_uri = "";
-
- /**
- * 로그인 처리
- */
- function doLogin() {
- var f = document.loginForm;
- if ( isEmpty(f.login_id) ) {
- ErrMsg(f.login_id, "'ID'를 입력해 주세요.");
- return;
- }
- if ( isEmpty(f.login_pw) ) {
- ErrMsg(f.login_pw, "'PASSWORD'를 입력해 주세요.");
- return;
- }
- if( f.chk_save_id != null ) {
- if ( f.chk_save_id.checked ) {
- setCookie(CookieID, f.login_id.value);
- } else {
- removeCookie(CookieID);
- }
- }
-
- $.get("/sign_on_check?login_id=" + f.login_id.value + "&login_pw=" + f.login_pw.value + "&chk_save_id=on", function(data, textStatus, xhr) {
- var $response = $($.parseXML(xhr.responseText));
- var $result = $(xhr.responseText).find("SUCCESS");
- if ($result.attr("value") == "false") { //패스워드 오류
- alert($result.text());
- return;
- }else if ($result.attr("value") == "pw_valid") { //패스워드 유효기간 만료
- alert($result.text());
- var url = "/jsp/ko_KR/buyer/sycs/user/ChangeExpiredPwd.screen";
- var win_id = "_changeExpiredPwd";
- var link = url;
- link += "?pop_win_id="+win_id;
- link += "&login_id="+f.login_id.value;
- link += "&sModule=LM";
- fLayerPop(win_id, link, 400,140, '', '', 'NO');
-
- return;
- }else if ($result.attr("value") == "pw_cnt") { //패스워드5회 이상 오류
- alert($result.text());
- location.href="/sign_off.screen";
- return;
- }
- location.replace("/main.screen");
- });
- // setFormDisabled(true);
- // if ( !submitXmlRequest("/sign_on_check", "", f, "valueobject") ) {
- // alert("Log in progress..");
- // };
- }
- function doLoginPortal() {
- var f = document.loginForm;
- if ( isEmpty(f.login_id) ) {
- ErrMsg(f.login_id, "'ID'를 입력해 주세요.");
- return;
- }
- if ( isEmpty(f.login_pw) ) {
- ErrMsg(f.login_pw, "'PASSWORD'를 입력해 주세요.");
- return;
- }
-
- if( f.chk_save_id != null ) {
- if ( f.chk_save_id.checked ) {
- setCookie(CookieID, f.login_id.value);
- } else {
- removeCookie(CookieID);
- }
- }
-
- $.get("/sign_on_portal_check?login_id=" + f.login_id.value + "&login_pw=" + f.login_pw.value + "&chk_save_id=on", function(data, textStatus, xhr) {
- var $response = $($.parseXML(xhr.responseText));
- var $result = $(xhr.responseText).find("SUCCESS");
- if ($result.attr("value") == "false") {
- alert($result.text());
- return;
- }
- location.replace("/mainPortal.screen");
- });
- // setFormDisabled(true);
- // if ( !submitXmlRequest("/sign_on_portal_check", "", f, "valueobject") ) {
- // alert("Log in progress..");
- // };
- }
- /**
- * 로그인 폼 Enabled/Disabled Set
- */
- function setFormDisabled(isDisabled) {
- try {
- var f = document.loginForm;
- f.login_id.disabled = isDisabled;
- f.login_pw.disabled = isDisabled;
- f.chk_save_id.disabled = isDisabled;
-
- if( isDisabled )
- document.all.login_btn.style.display = "none";
- else
- document.all.login_btn.style.display = "";
- }
- catch(errorObject) {
-
- }
- }
-
- /**
- * 로그인 페이지의 입력항목 초기화
- */
- function doReset() {
- var f = document.loginForm;
- f.isSubmit = false;
- f.login_id.value = "";
- f.login_pw.value = "";
- }
-
- /**
- * 로그인 처리후 Forward 될 URI를 세팅
- */
- function setForwardUri(forward_uri) {
- this.forward_uri = forward_uri;
- }
- /**
- * 문자열 변경함수
- * trim()
- */
- String.prototype.trim = function() {
- return this.replace(/(^\s*)|(\s*$)/gi, "");
- };
- /**
- * 문자열 변경함수
- * replaceAll
- */
- String.prototype.replaceAll = function(str1, str2) {
- var temp_str = "";
- if (this.trim() != "" && str1 != str2) {
- temp_str = this.trim();
- while (temp_str.indexOf(str1) > -1) {
- temp_str = temp_str.replace(str1, str2);
- }
- }
- return temp_str;
- };
- /**
- * 로그인 처리 결과
- */
- function doResult(resultObj) {
- var f = document.loginForm;
- try {
-
- if( resultObj.getRequestEvent() == "USER_APPR_CHK")
- {
- document.loginForm.isSubmit = false;
-
- var corp_status_name = resultObj.getValueObject().get("corp_status_name");
- var status_code = resultObj.getValueObject().get("status_code");
- var comment = resultObj.getValueObject().get("comment");
-
- if(corp_status_name == "END_DATE")
- {
- alert("이용기간이 종료되어 이용하실 수 없습니다. 관리자에게 문의하세요.");
- return;
- }
-
- /*if(status_code == "91") 2018.05.17 거래중지 로그인 가능
- {
- var win_id = "_searchChkUser";
- var link = "/loginChkUser.screen";
- link += "?pop_win_id="+win_id+"&layerYn=Y";
- link += "&title="+ encodeURIComponent("거래중지") + "&comment=" + encodeURIComponent(comment.replace(/\n/gi, "<br/>"));
- fLayerPop(win_id, link, 300,100, '', '', 'auto');
-
-
- return;
- }*/
-
- /*if(status_code == "99") 2018.05.17 거래취소사유 보이지 않도록 .doLoginPortal 에서 상태값 99는 로그인 못함.
- {
- var win_id = "_searchChkUser";
- var link = "/loginChkUser.screen";
- link += "?pop_win_id="+win_id+"&layerYn=Y";
- link += "&title="+ encodeURIComponent("거래취소") + "&comment=" + encodeURIComponent(comment.replace(/\n/gi, "<br/>"));
- fLayerPop(win_id, link, 300,100, '', '', 'auto');
-
-
- return;
- }*/
-
- doLoginPortal();
- }
- else
- {
- if( resultObj.getType() == "VALUEOBJECT" ) {
- if( resultObj.getSuccess() ) {
- try {
- var vo = resultObj.getValueObject();
- if( vo.get("login_pw_mod_period") > 0 || vo.get("login_pw_encription") >0 ) {
- alert("만료 페이지 보여주어야 함");
- self.location.href = "/expired.screen";
- }else if(vo.get("portal_check") == "LOGIN_POTAL"){
- self.location.href = "/mainPortal.screen";
- } else{
- self.location.href = "/main.screen";
- }
- } catch(errorObject) {
- }
- } else {
- //dlgErrorMsg(resultObj);
- alert("로그인에 실패 하였습니다.\n아이디 또는 비밀번호를 확인 바랍니다.");
- f.isSubmit = false;
- setFormDisabled(false);
- return;
- }
- }
- }
-
- } catch(errorObject) {
- showErrorDlg("doResult()", errorObject);
- setFormDisabled(false);
- }
- }
- /**
- * Enter 처리
- */
- function enter(index, portal) {
- var f = document.loginForm;
- if( event.keyCode == 13 ) {
- if( index == 1 ) {
- f.login_pw.focus();
- } else if( index == 2 ) {
- if(portal=="Y")doLoginPortal();
- else doLogin();
- }
- }
- }
- /**
- * 로그인 ID Save 처리
- */
- function chkSaveID(obj) {
- if( obj.checked ) {
- var msg = "로그인 ID를 저장하시면 로그인시에 로그인 ID가 자동으로 입력됩니다.\n\n"
- + "여러 사용자가 같이 사용하시는 PC에 경우 ID가 다른 사용자에게 공개될 수 있습니다.\n\n"
- + "ID를 저장 하시겠습니까 ?";
- if( !confirm(msg) ) {
- obj.checked = !obj.checked;
- }
- }
- }
- /**
- * Cookie 저장
- */
- function setCookie( name, value ) {
- var todayDate = new Date();
- todayDate.setDate( todayDate.getDate() + 365 );
- document.cookie = name + "=" + escape( value ) + "; path=/;expires="+ todayDate.toGMTString() +";";
- }
- /**
- * Cookie 제거
- */
- function removeCookie( name ) {
- var todayDate = new Date();
- todayDate.setDate( todayDate.getDate() - 1 );
- document.cookie = name + "=; path=/; expires="+ todayDate.toGMTString() +";";
- }
- /**
- * Cookie 읽기
- */
- function getCookie( name ) {
- var nameOfCookie = name + "=";
- var x = 0;
- while ( x <= document.cookie.length ) {
- var y = (x+nameOfCookie.length);
- if ( document.cookie.substring( x, y ) == nameOfCookie ) {
- if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
- endOfCookie = document.cookie.length;
- return unescape( document.cookie.substring( y, endOfCookie ) );
- }
- x = document.cookie.indexOf( " ", x ) + 1;
- if ( x == 0 )
- break;
- }
- return "";
- }
-
- function findLoginID() {
- alert('findLoginID');
- }
- function findLoginPW() {
- alert('findLoginPW');
- }
-
- function changeExpiredPwdClose(result){
- setTimeout(function(){fLayerPopClose('_changeExpiredPwd');},100);
- location.href="/sign_off.screen";
- }
|