로그인 수정

This commit is contained in:
USER
2022-08-08 10:56:47 +09:00
parent e67838c044
commit a4a11e5c3b
4 changed files with 56 additions and 65 deletions

View File

@@ -97,7 +97,6 @@ export default {
for(var i = 0; i < dimmed.length; i++){ for(var i = 0; i < dimmed.length; i++){
dimmed[i].style.display = 'none'; dimmed[i].style.display = 'none';
} }
console.log(this.callFnc)
if(this.callFnc !== ''){ if(this.callFnc !== ''){
this.$parent.alertCalbackFnc(this.callFnc); this.$parent.alertCalbackFnc(this.callFnc);
} }

View File

@@ -1,7 +1,7 @@
import httpClient from '@/common/http-client'; import httpClient from '@/common/http-client';
const login = (params) => { const login = (params) => {
return httpClient.post('api/v1/bo/login/login', params, { headers: {"show-layer": "Yes"} },{ withCredentials: false }); return httpClient.post('/api/v1/bo/login/login', params, { headers: {"show-layer": "Yes"} },{ withCredentials: false });
}; };
const chgpwd = (params) => { const chgpwd = (params) => {

View File

@@ -6,10 +6,10 @@
<div class="wbox"> <div class="wbox">
<h3 class="title">2 휴대폰 문자 인증</h3> <h3 class="title">2 휴대폰 문자 인증</h3>
<p class="desc">아이디에 등록된 휴대폰번호를 입력해 주세요.</p> <p class="desc">아이디에 등록된 휴대폰번호를 입력해 주세요.</p>
<!-- <form action=""> -->
<ul class="pw-form"> <ul class="pw-form">
<div> <div>
<li><input type="text" <li><input type="text"
ref="_phone"
placeholder="휴대폰번호를 입력하세요 (숫자만 입력하세요.)" placeholder="휴대폰번호를 입력하세요 (숫자만 입력하세요.)"
v-model="mdn" v-model="mdn"
:maxlength="11" :maxlength="11"
@@ -32,11 +32,9 @@
<button class="btn-pcolor" v-on:click="ajaxAuth">확인</button> <button class="btn-pcolor" v-on:click="ajaxAuth">확인</button>
</li> </li>
</ul> </ul>
<!-- </form> -->
</div> </div>
</div> </div>
<login-popup ref="LoginPopup"> </login-popup>
<common-modal ref="commmonModal"></common-modal> <common-modal ref="commmonModal"></common-modal>
</div> </div>
@@ -45,9 +43,7 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import api from '../service/api'; import api from '../service/api';
// import tokenSvc from '@/common/token-service';
import { utils_mixin, chkPattern2 } from '../service/mixins'; import { utils_mixin, chkPattern2 } from '../service/mixins';
import LoginPopup from '@/components/LoginPopup.vue'
import commonModal from "../components/commonModal"; import commonModal from "../components/commonModal";
export default { export default {
@@ -66,6 +62,7 @@ export default {
mdn: '', mdn: '',
confirmNum: '', confirmNum: '',
// userId: '', // userId: '',
oprtrId : '',
isAuthNum: false, isAuthNum: false,
isLogin: false, isLogin: false,
isAuth: false, isAuth: false,
@@ -79,32 +76,23 @@ export default {
}; };
}, },
components: { components: {
LoginPopup : LoginPopup commonModal
,commonModal
}, },
created() { created() {
const historyUrl = this.$router.options.history.state.back;
console.log(historyUrl);
console.log('>>>>1111>>>>'+this.getLogin);
if(!this.getLogin){ if(!this.getLogin){
this.$router.push({ path: '/login' }); this.$router.push({ path: '/login' });
} }
// if(!!tokenSvc.getToken()){
// this.$store.commit("login/isLogin", true);
// this.$store.commit("login/isAuthChk", true);
// this.$router.push({ path: '/' });
// }else{
// if(!this.getLogin){
// this.$router.push({ path: '/login' });
// }
// }
}, },
mounted() { mounted() {
if (localStorage.hubwebUserId) { if (localStorage.hubwebUserId) {
this.userId = localStorage.hubwebUserId; this.oprtrId = localStorage.hubwebUserId;
} }
this.$store.commit("login/isLogin", false);
this.isLogin = this.getLogin; this.isLogin = this.getLogin;
this.pwd = this.getPwd; this.pwd = this.getPwd;
this.ajaxlogin();
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
@@ -140,6 +128,36 @@ export default {
cont.classList.remove("bg-wrap"); cont.classList.remove("bg-wrap");
}, },
methods: { methods: {
// 1차 인증
async ajaxlogin() {
var vm = this;
vm.errors = null;
if (!this.oprtrId){
this.$router.push({ path: '/login' });
}
if (!this.pwd){
this.$router.push({ path: '/login' });
}
var params = {
"oprtrId": this.oprtrId,
"oprtrPw": this.pwd,
}
try {
const response = await api.login(params);
const rsp = response.data;
if(rsp.retCode == '0000'){
vm.$store.commit("login/isLogin", true);
} else {
vm.$store.commit("login/isLogin", false);
this.$router.push({ path: '/login' });
}
} catch(err) {
this.$router.push({ path: '/login' });
}
},
// 2차 인증번호 요청 // 2차 인증번호 요청
async authNum(){ async authNum(){
var vm = this; var vm = this;
@@ -177,7 +195,6 @@ export default {
} }
try { try {
const response = await api.authNum(params) const response = await api.authNum(params)
console.log(response);
var rsp = response.data; var rsp = response.data;
if(rsp.retCode == '0000') { if(rsp.retCode == '0000') {
this.timerStop(this.timer); this.timerStop(this.timer);
@@ -266,17 +283,13 @@ export default {
try { try {
const response = await api.confirmNum(params) const response = await api.confirmNum(params)
const rsp = response.data; const rsp = response.data;
console.log("LOGIN ßRESUßLT_CODE : "+rsp.retCode);
console.log(rsp);
if(rsp.retCode == '0000'){ if(rsp.retCode == '0000'){
vm.$store.commit("login/isLogin", true); vm.$store.commit("login/isLogin", true);
vm.$store.commit("login/isAuthChk", true); vm.$store.commit("login/isAuthChk", true);
vm.$store.commit("login/userId", rsp.data.userId) vm.$store.commit("login/userId", rsp.data.userId)
vm.$store.commit("login/userNm", rsp.data.userNm) vm.$store.commit("login/userNm", rsp.data.userNm)
var rootUrl = rsp.data.nextUrl; var rootUrl = rsp.data.nextUrl;
console.log('rootUrl : '+rootUrl);
vm.$store.commit("login/rootUrl", rsp.data.nextUrl); vm.$store.commit("login/rootUrl", rsp.data.nextUrl);
console.log(vm.$store.getters);
vm.$router.push({ path: rootUrl}); vm.$router.push({ path: rootUrl});
}else if (rsp.retCode == '4008'){ }else if (rsp.retCode == '4008'){
this.row.title = '휴대폰번호 확인'; this.row.title = '휴대폰번호 확인';
@@ -334,9 +347,7 @@ export default {
}); });
}, },
ModalOpen: function(target){
this.$refs.LoginPopup.ModalOpen(target);
},
timerStart: function() { timerStart: function() {
// 1초에 한번씩 start 호출 // 1초에 한번씩 start 호출
this.timeCounter = 180; this.timeCounter = 180;
@@ -372,7 +383,6 @@ export default {
); );
}, },
alertCalbackFnc(callFnc){ alertCalbackFnc(callFnc){
console.log(callFnc)
if(callFnc === 'login'){ if(callFnc === 'login'){
this.$router.push({ path: '/'}); this.$router.push({ path: '/'});
} }

View File

@@ -5,7 +5,6 @@
<div class="wbox"> <div class="wbox">
<div class="logo"></div> <div class="logo"></div>
<h3 class="title">관리자 로그인</h3> <h3 class="title">관리자 로그인</h3>
<!-- <form action=""> -->
<div class="login-form"> <div class="login-form">
<li><input type="text" placeholder="아이디" v-model="userId"></li> <li><input type="text" placeholder="아이디" v-model="userId"></li>
<li><input type="password" placeholder="비밀번호" v-model="userPwd" @keyup.enter="ajaxlogin"></li> <li><input type="password" placeholder="비밀번호" v-model="userPwd" @keyup.enter="ajaxlogin"></li>
@@ -15,7 +14,6 @@
</li> </li>
<li><button class="btn-pcolor" @click="ajaxlogin">로그인</button></li> <li><button class="btn-pcolor" @click="ajaxlogin">로그인</button></li>
</div> </div>
<!-- </form> -->
<div class="login-notice"> <div class="login-notice">
<div> <div>
<li>비밀번호 분실 비밀번호 초기화를 이용해주세요.</li> <li>비밀번호 분실 비밀번호 초기화를 이용해주세요.</li>
@@ -25,7 +23,6 @@
</div> </div>
</div> </div>
<login-popup ref="LoginPopup"> </login-popup>
<common-modal ref="commonModal"></common-modal> <common-modal ref="commonModal"></common-modal>
</div> </div>
@@ -33,7 +30,6 @@
<script> <script>
import api from '../service/api'; import api from '../service/api';
//import LoginPopup from '@/components/LoginPopup.vue';
import tokenSvc from '@/common/token-service'; import tokenSvc from '@/common/token-service';
import commonModal from "../components/commonModal"; import commonModal from "../components/commonModal";
@@ -71,7 +67,6 @@ export default {
cont.classList.remove("login-wrap"); cont.classList.remove("login-wrap");
}, },
components: { components: {
// LoginPopup : LoginPopup,
commonModal, commonModal,
}, },
methods: { methods: {
@@ -90,8 +85,7 @@ export default {
var vm = this; var vm = this;
vm.errmsg = null; vm.errmsg = null;
this.row = {} this.row = {}
// if (!vm.formCheck()) return false;
console.log(this.userId)
if (!this.userId){ if (!this.userId){
this.row.title = '로그인 실패'; this.row.title = '로그인 실패';
this.row.msg1 = '아이디,비밀번호를 확인해주세요.'; this.row.msg1 = '아이디,비밀번호를 확인해주세요.';
@@ -118,19 +112,16 @@ export default {
try { try {
const response = await api.login(params) const response = await api.login(params)
const rsp = response.data; const rsp = response.data;
console.log(rsp);
if(rsp.retCode == '0000'){ if(rsp.retCode == '0000'){
var path = rsp.data.nextUrl;
console.log(path);
console.log(rsp.data);
vm.chgChkUserId(); vm.chgChkUserId();
vm.$store.commit("login/isLogin", true); vm.$store.commit("login/isLogin", true);
vm.$store.commit("login/savePwd", oprtrPw); vm.$store.commit("login/savePwd", oprtrPw);
vm.$router.push({ name: 'loginAuth',params: {userId : oprtrId}}); vm.$router.push({ name: 'loginAuth',params: {userId : oprtrId}});
} else if(rsp.retCode == '1001'){ // 비밀번호 변경 } else if(rsp.retCode == '1001'){ // 비밀번호 변경
console.log(this.userId);
vm.chgChkUserId(); vm.chgChkUserId();
this.$store.commit("login/isLogin", true);
this.$router.push({ name: 'updatePassword',params: {userId : this.userId}}); this.$router.push({ name: 'updatePassword',params: {userId : this.userId}});
}else if(rsp.retCode == '4003') { // ID 조회 없음. }else if(rsp.retCode == '4003') { // ID 조회 없음.
this.row.title = '로그인 실패'; this.row.title = '로그인 실패';
@@ -147,7 +138,6 @@ export default {
this.row.msg1 = '로그인 5회 실패하였습니다.'; this.row.msg1 = '로그인 5회 실패하였습니다.';
this.row.msg2 = '비밀번호 초기화 후 비밀번호를 변경해 주세요.'; this.row.msg2 = '비밀번호 초기화 후 비밀번호를 변경해 주세요.';
this.row.callFnc = 'resetPassword' this.row.callFnc = 'resetPassword'
console.log(this.row)
this.$refs.commonModal.alertModalOpen(this.row); this.$refs.commonModal.alertModalOpen(this.row);
} else if(rsp.retCode == '4006') { } else if(rsp.retCode == '4006') {
// msg = '비밀번호를 변경하신지 90일이 지났습니다.\n비밀번호 변경 화면으로 이동합니다.'; // msg = '비밀번호를 변경하신지 90일이 지났습니다.\n비밀번호 변경 화면으로 이동합니다.';
@@ -156,7 +146,6 @@ export default {
this.row.msg2 = '지났습니다. 비밀번호를 변경하여'; this.row.msg2 = '지났습니다. 비밀번호를 변경하여';
this.row.msg3 = '이용 부탁드립니다.'; this.row.msg3 = '이용 부탁드립니다.';
this.row.callFnc = 'updatePassword' this.row.callFnc = 'updatePassword'
//vm.$store.commit("login/isLogin", true);
this.$refs.commonModal.alertModalOpen(this.row); this.$refs.commonModal.alertModalOpen(this.row);
} else if(rsp.retCode == '4007') { } else if(rsp.retCode == '4007') {
this.row.title = '로그인 실패'; this.row.title = '로그인 실패';
@@ -168,7 +157,6 @@ export default {
return; return;
} }
} catch(err) { } catch(err) {
//alert("실패 하였습니다.");
this.row.title = '로그인'; this.row.title = '로그인';
this.row.msg1 = '실패 하였습니다.'; this.row.msg1 = '실패 하였습니다.';
this.$refs.commmonModal.alertModalOpen(this.row); this.$refs.commmonModal.alertModalOpen(this.row);
@@ -183,17 +171,11 @@ export default {
path: link path: link
}); });
}, },
ModalOpen: function(target){
// this.$refs.LoginPopup.ModalOpen(target);
},
alertCalbackFnc(callFnc){ alertCalbackFnc(callFnc){
console.log(callFnc)
if(callFnc === 'resetPassword'){ if(callFnc === 'resetPassword'){
this.$router.push({ name: 'resetPassword',params: {}}); this.$router.push({ name: 'resetPassword',params: {}});
}else if(callFnc === 'updatePassword'){ }else if(callFnc === 'updatePassword'){
// this.$router.push({ name: 'updatePassword', params: {}}).catch(()=>{});
// this.$router.push({ name: 'updatePassword', params: {userId : this.userId} });
// this.$router.push({ path: '/view/login/updatePassword', params: {userId : this.userId}});
this.$store.commit("login/isLogin", true); this.$store.commit("login/isLogin", true);
this.$store.commit("login/isAuthChk", false); this.$store.commit("login/isAuthChk", false);
this.$router.push({ name: 'updatePassword',params: {userId : this.userId}}); this.$router.push({ name: 'updatePassword',params: {userId : this.userId}});