let objSignIn; $(function(){ objSignIn = new SignIn(); }); class SignIn { constructor() { if (document.location.href.includes("techlibrary")) { this.strHost = "member.itworld.co.kr/techlibrary"; } else if (document.location.href.includes("techplay")) { this.strHost = "member.itworld.co.kr/techplay"; } else { this.strHost = "member.itworld.co.kr"; } this.ssoTargetDomain = "https://member.ciokorea.com"; this.jsonGotoAction = { 'join':'//'+this.strHost+'/join/index', 'login':'//'+this.strHost+'/login/index', 'find_password':'//'+this.strHost+'/login/find_password' }; if($('#frm_sign_in').length>0){ this.initSignIn(); } } initSignIn(){ const eleForm = $('#frm_sign_in'); var options = { url : '//member.itworld.co.kr/_connector/yellow.501.php', data : { 'viewID' : 'MEMBER_SIGN_IN' }, dataType : 'json', resetForm : false, type : 'post', // 'get' or 'post', override for form's 'method' attribute beforeSubmit : function() { let ele; ele = eleForm.find('#business_email'); if(!$.trim(ele.val())){ ele.addClass('is-invalid'); ele.focus(); return(false); }else{ ele.removeClass('is-invalid'); } ele = eleForm.find('#pwd'); if(!$.trim(ele.val())){ ele.addClass('is-invalid'); ele.focus(); return(false); }else{ ele.removeClass('is-invalid'); } return(true); }, success : function(jsonResult) { if(jsonResult.result){ console.log(jsonResult); $('body').append(jsonResult.sso_script); const eleSourceForm = $('#frm_sign_in'); let strSubmitMethod = 'post'; // let eleTargetForm = $('
'); if(eleSourceForm.find('#insider_action').val() && eleSourceForm.find('#content_id').val()){ strSubmitMethod = 'post'; } const signup_return = 'https://'+objSignIn.strHost+'/action/index'; const insider_action = eleSourceForm.find('#insider_action').val(); const content_id = eleSourceForm.find('#content_id').val(); const return_url = eleSourceForm.find('#return_url').val(); let eleTargetForm = $('
'); eleTargetForm.append(''); eleTargetForm.append(''); eleTargetForm.append(''); eleTargetForm.append(''); eleTargetForm.append(''); eleTargetForm.append(''); /* let eleTargetForm = $('
'); eleTargetForm.append(''); eleTargetForm.append(''); eleTargetForm.append(''); */ $('body').append(eleTargetForm); setTimeout(function(){eleTargetForm[0].submit();},500); }else{ switch(jsonResult.error_code){ case(404): alert('가입되지 않은 이메일입니다.'); $('#pwd').select(); break; case(403): alert('로그인 정보를 확인하세요.'); $('#pwd').select(); break; } } } } eleForm.ajaxForm(options); } signOut(){ $.ajax({ type: 'POST', url: '//member.itworld.co.kr/_connector/yellow.501.php', data:{'viewID':'MEMBER_SIGN_OUT'}, dataType: 'json', success: function(jsonResult){ if(jsonResult.result){ window.document.location.href='//'+objSignIn.strHost+'/login/'; } } }); } gotoPageWithAction(strActionType){ $('#frm_join').attr({'action':this.jsonGotoAction[strActionType]}); $('#frm_join').submit(); } }