소스검증을 위한 수정 변경

This commit is contained in:
kimre
2022-07-12 12:26:45 +09:00
parent 74511fb587
commit 3d7032432c
40 changed files with 2028 additions and 2120 deletions

View File

@@ -48,7 +48,7 @@ import api from '../service/api';
import tokenSvc from '@/common/token-service';
import { utils_mixin, chkPattern2 } from '../service/mixins';
import LoginPopup from '@/components/LoginPopup.vue'
import commonModal from "@/components/modal/commonModal";
import commonModal from "../components/commonModal";
export default {
name: 'Params',
@@ -137,16 +137,26 @@ export default {
async authNum(){
var vm = this;
let userId = vm.$route.params.userId;
this.row = {}
if(!this.isLogin){
vm.$store.commit("login/isLogin", false);
vm.$store.commit("login/isAuthChk", false);
vm.$router.push({ path: '/'});
return;
return false;
}
const hp = this.mdn;
if(this.isNull(hp)){
this.row.title = '로그인';
this.row.msg1 = '휴대폰번호를 입력하세요.';
this.$refs.commmonModal.alertModalOpen(this.row);
return false;
}
if(!this.isNull(hp) && !this.isMobile(hp)){
this.row.title = '관리자/유치채널 관리';
this.row.title = '로그인';
this.row.msg1 = '휴대폰 번호 형식이 잘못되었습니다. 확인해 주세요.';
this.$refs.commmonModal.alertModalOpen(this.row);
this.$refs._phone.focus();
@@ -162,13 +172,26 @@ export default {
const response = await api.authNum(params)
console.log(response);
var rsp = response.data;
if(rsp.retCode == '0000'){
if(rsp.retCode == '0000') {
this.timerStop(this.timer);
this.timer = this.timerStart();
this.row.title = '인증번호 발송';
this.row.msg1 = '인증번호를 발송하였습니다.';
this.$refs.commmonModal.alertModalOpen(this.row);
this.isAuthNum = true;
}else if(rsp.retCode == '4008'){
this.row.title = '휴대폰번호 확인';
this.row.msg1 = '휴대폰번호를 확인해주세요.';
this.row.msg2 = '아이디에 등록된 휴대폰번호로만 인증이 가능합니다.';
this.$refs.commmonModal.alertModalOpen(this.row);
}else if(rsp.retCode == '4011'){
this.row.title = '인증실패';
this.row.msg1 = '잘못된 인증번호입니다.';
this.row.msg2 = '5회 실패 시 로그아웃됩니다.';
this.row.callFnc = 'login'
vm.$store.commit("login/isLogin", false);
vm.$store.commit("login/isAuthChk", false);
this.$refs.commmonModal.alertModalOpen(this.row);
}else if (!this.timer) {
this.timerStop(this.timer);
this.timer = null;
@@ -187,7 +210,7 @@ export default {
async ajaxAuth(){
var vm = this;
let userId = vm.$route.params.userId;
this.row = {}
if(!this.mdn){
this.row.title = '휴대폰번호 확인';
this.row.msg1 = '휴대폰번호를 확인해 주세요.';
@@ -209,7 +232,11 @@ export default {
}
if(this.timeCounter == 0){
this.ModalOpen('modal10');
// this.ModalOpen('modal10');
this.row.title = '인증실패';
this.row.msg1 = '인증시간 초과되었습니다.';
this.row.msg2 = '다시 휴대폰번호를 입력해주세요.';
this.$refs.commmonModal.alertModalOpen(this.row);
return false;
}
var params = {
@@ -324,7 +351,12 @@ export default {
+ secondes.toString().padStart(2, "0")
);
},
alertCalbackFnc(callFnc){
console.log(callFnc)
if(callFnc === 'login'){
this.$router.push({ path: '/'});
}
},
}
};
</script>

View File

@@ -1,4 +1,6 @@
<template>
<template>
<div>
<div class="login-box adm-login">
<div class="wbox">
<div class="logo"></div>
@@ -22,9 +24,11 @@
</div>
</div>
</div>
<login-popup ref="LoginPopup"> </login-popup>
<common-modal ref="commonModal"></common-modal>
</div>
</div>
</template>
<script>
@@ -67,7 +71,7 @@ export default {
cont.classList.remove("login-wrap");
},
components: {
LoginPopup : LoginPopup,
// LoginPopup : LoginPopup,
commonModal,
},
methods: {
@@ -85,6 +89,7 @@ export default {
var vm = this;
vm.errmsg = null;
this.row = {}
// if (!vm.formCheck()) return false;
console.log(this.userId)
if (!this.userId){
@@ -145,7 +150,7 @@ export default {
this.row.msg1 = '비밀번호를 변경하지 않은지 90일이';
this.row.msg2 = '지났습니다. 비밀번호를 변경하여';
this.row.msg3 = '이용 부탁드립니다.';
vm.$router.push({ name: 'updatePassword',params: {userId : oprtrId}});
this.row.callFnc = 'updatePassword'
this.$refs.commonModal.alertModalOpen(this.row);
} else if(rsp.retCode == '4007') {
this.row.title = '로그인 실패';
@@ -173,11 +178,18 @@ export default {
});
},
ModalOpen: function(target){
this.$refs.LoginPopup.ModalOpen(target);
// this.$refs.LoginPopup.ModalOpen(target);
},
alertCalbackFnc(callFnc){
console.log(callFnc)
if(callFnc === 'resetPassword'){
this.$router.push({ name: 'resetPassword',params: {}});
}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.$router.push({ name: 'updatePassword',params: {userId : this.userId}});
}
},

View File

@@ -49,28 +49,17 @@ export default {
commonModal,
},
methods: {
formCheck: function()
{
this.errors = [];
if (!this.userId) {
this.row.title = '아이디 오류';
this.row.msg1 = '아이디를 입력해 주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
// this.errors.push('아이디를 입력해 주세요.');
}
return this.errors.length == 0;
},
async ajaxReset(){
var vm = this;
//vm.errmsg = null;
if (!vm.formCheck()) return false;
if (!this.userId) {
this.row.title = '아이디 오류';
this.row.msg1 = '아이디를 입력해 주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
return false;
}
var params =
{
"userId": this.userId,
//"userPwd": this.userPwd,
"userId": this.userId
}
try {
const response = await api.resetPassword(params)
@@ -94,7 +83,6 @@ export default {
this.$refs.commonModal.alertModalOpen(this.row);
}
} catch(err) {
//alert("실패 하였습니다.");
console.log(err)
this.row.title = '비밀번호 초기화';
this.row.msg1 = '실패 하였습니다.';

View File

@@ -1,243 +1,219 @@
<template>
<div>
<div class="login-box pw-change">
<div class="logo"></div>
<div class="wbox">
<h3 class="title">비밀번호 변경</h3>
<p class="desc">임시비밀번호로 로그인할 경우 비밀번호를 변경 <br>서비스 이용이 가능합니다.</p>
<div>
<div class="login-box pw-change">
<div class="logo"></div>
<div class="wbox">
<h3 class="title">비밀번호 변경</h3>
<p class="desc">임시비밀번호로 로그인할 경우 비밀번호를 변경 <br>서비스 이용이 가능합니다.</p>
<ul class="pw-form">
<li><input type="password" placeholder="기존 비밀번호를 입력하세요" v-model="oldPw" ref="oldPw"></li>
<li><input type="password" placeholder="새로운 비밀번호를 입력하세요" required minlength="8" maxlength="16" v-model.trim="newPw" ref="_newPw"></li>
<li><input type="password" placeholder="새로운 비밀번호를 다시 한 번 입력하세요" required minlength="8" maxlength="16" v-model.trim="newPw2" ref="_newPw2"></li>
<li><button class="btn-pcolor" @click="changedPwd()">비밀번호 변경하기</button></li>
</ul>
</div>
</div>
<common-modal ref="commonModal"></common-modal>
</div>
<common-modal ref="commonModal"></common-modal>
</div>
</template>
<script>
import lodash from "lodash";
import api from '../service/api';
import { mapGetters } from 'vuex';
import tokenSvc from '@/common/token-service';
import { commonPwdView, validation } from '../service/mixins';
import commonModal from "../components/commonModal";
export default {
mixins: [commonPwdView, validation],
name: 'updatePassword',
data: function() {
return {
userId: '',
oldPw: '',
newPw: '',
newPw2: '',
passwordValidFlag: true,
row: {},
};
return {
userId: '',
oldPw: '',
newPw: '',
newPw2: '',
passwordValidFlag: true,
row: {},
}
},
created() {
this.$store.commit("login/isLogin", true);
this.$store.commit("login/isAuthChk", false);
},
computed: {
},
components: {
commonModal,
},
mounted() {
// this.$refs.chkSaveId.checked = true;
if (localStorage.hubwebUserId) {
this.userId = localStorage.hubwebUserId;
}
this.isLogin = this.getLogin;
this.oldPw = this.getPwd;
},
methods: {
verifyNewPw: function() {
this.message.newPw = '';
},
created: function() {
this.$store.commit("login/isLogin", true);
this.$store.commit("login/isAuthChk", false);
},
mounted() {
// this.$refs.chkSaveId.checked = true;
formCheck: function() {
this.errors = [];
if (localStorage.hubwebUserId) {
this.userId = localStorage.hubwebUserId;
}
this.isLogin = this.getLogin;
this.oldPw = this.getPwd;
},
computed: {
...mapGetters({
getLogin: 'login/isLogin',
getPwd: 'login/getPwd'
}),
},
if (!this.oldPw) this.errors.push('기존비밀번호');
if (!this.newPw) this.errors.push('새로운비밀번호');
watch: {
getLogin(data) {
if (data != null && data != '' && data == true) {
this.isLogin = true;
} else {
this.isLogin = false;
}
},
getPwd(data) {
if(data != null && data != ''){
this.pwd = data;
}
}
},
components: {
commonModal,
return this.errors.length == 0;
},
methods: {
verifyNewPw: function() {
this.message.newPw = '';
},
doPwdValidate(){
console.log(this.userId)
//debugger;
if(lodash.isNull(this.newPw)){
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호 확인을 입력해 주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
this.$refs._newPw2.focus();
return false;
}
if(!lodash.isEqual(this.newPw, this.newPw2)){
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호가 일치하지 않습니다.';
this.$refs.commonModal.alertModalOpen(this.row);
this.$refs._newPw2.focus();
return false;
}
const pwdLen = this.bytes(this.newPw);
if(!(pwdLen >= 8 && pwdLen <= 16)){
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호는 8~16자의 영문, 숫자, 특수문자(!,@, $, %, ^, &, *) 조합이 필요합니다.';
this.$refs.commonModal.alertModalOpen(this.row);
this.$refs._newPw2.focus();
return false;
}
const pEng = /[A-Za-z]/g; // 영문자
const pNum = /[0-9]/g; // 숫자
const pSpc = /[!@$%^&*]/g; // 특수문자
if(!(pEng.test(this.newPw) && pNum.test(this.newPw) && pSpc.test(this.newPw))) {
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호는 8~16자의 영문, 숫자, 특수문자(!,@, $, %, ^, &, *) 조합이 필요합니다.';
this.$refs.commonModal.alertModalOpen(this.row);
this.$refs._newPw2.focus();
return;
}
return true;
},
formCheck: function() {
this.errors = [];
//비밀번호 유효성 체크
async changedPwd() {
if (!this.oldPw) this.errors.push('기존비밀번호');
if (!this.newPw) this.errors.push('새로운비밀번호');
if(this.doPwdValidate()){
var vm = this;
return this.errors.length == 0;
},
var params = {
doPwdValidate(){
//debugger;
if(lodash.isNil(this.newPw)){
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호 확인을 입력해 주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
this.$refs._newPw2.focus();
return false;
"userId": this.userId,
"oldPw": this.oldPw,
"newPw": this.newPw
}
if(!lodash.isEqual(this.newPw, this.newPw2)){
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호가 일치하지 않습니다.';
this.$refs.commonModal.alertModalOpen(this.row);
this.$refs._newPw2.focus();
return false;
}
const pwdLen = this.bytes(this.newPw);
if(!(pwdLen >= 8 && pwdLen <= 16)){
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호는 8~16자의 영문, 숫자, 특수문자(!,@, $, %, ^, &, *) 조합이 필요합니다.';
this.$refs.commonModal.alertModalOpen(this.row);
this.$refs._newPw2.focus();
return false;
}
const pEng = /[A-Za-z]/g; // 영문자
const pNum = /[0-9]/g; // 숫자
const pSpc = /[!@$%^&*]/g; // 특수문자
if(!(pEng.test(this.newPw) && pNum.test(this.newPw) && pSpc.test(this.newPw))) {
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호는 8~16자의 영문, 숫자, 특수문자(!,@, $, %, ^, &, *) 조합이 필요합니다.';
this.$refs.commonModal.alertModalOpen(this.row);
this.$refs._newPw2.focus();
return;
}
return true;
},
//비밀번호 유효성 체크
async changedPwd() {
if(this.doPwdValidate()){
var vm = this;
var params = {
"userId": this.userId,
"oldPw": this.oldPw,
"newPw": this.newPw
}
try {
try {
const response = await api.updatePassword(params)
const rsp = response.data;
console.log("RESULT_CODE : "+rsp.retCode);
if(rsp.retCode == '0000') {
// vm.chgChkUserId();
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호가 정상적으로 변경되었습니다.';
this.row.msg2 = '변경된 비밀번호로 다시 로그인 해주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
// if(vm.ModalOpen('modal16')){
vm.$router.push({ path: '/login' });
// }
} else if(rsp.retCode == '4016') {
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호를 확인해주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
// vm.ModalOpen('modal14')
} else if(rsp.retCode == '4017') {
this.row.title = '비밀번호 오류';
this.row.msg1 = '비밀번호를 사용할 수 없습니다.';
this.row.msg2 = '비밀번호는 영문/숫자/특수기호를 혼합하여';
this.row.msg3 = '8~16자리로 설정해주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
// vm.ModalOpen('modal15')
} else if(rsp.retCode == '4003') {
this.row.title = '아이디 오류';
this.row.msg1 = '등록되지 않은 아이디입니다.';
this.$refs.commonModal.alertModalOpen(this.row);
}
} catch(err) {
//alert("실패 하였습니다.");
console.log(err)
this.row.title = '비밀번호 초기화';
this.row.msg1 = '실패 하였습니다.';
if(rsp.retCode == '0000') {
// vm.chgChkUserId();
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호가 정상적으로 변경되었습니다.';
this.row.msg2 = '변경된 비밀번호로 다시 로그인 해주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
return false;
// if(vm.ModalOpen('modal16')){
// }
} else if(rsp.retCode == '4016') {
this.row.title = '비밀번호 변경';
this.row.msg1 = '비밀번호를 확인해주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
// vm.ModalOpen('modal14')
} else if(rsp.retCode == '4017') {
this.row.title = '비밀번호 오류';
this.row.msg1 = '비밀번호를 사용할 수 없습니다.';
this.row.msg2 = '비밀번호는 영문/숫자/특수기호를 혼합하여';
this.row.msg3 = '8~16자리로 설정해주세요.';
this.$refs.commonModal.alertModalOpen(this.row);
// vm.ModalOpen('modal15')
} else if(rsp.retCode == '4003') {
this.row.title = '아이디 오류';
this.row.msg1 = '등록되지 않은 아이디입니다.';
this.$refs.commonModal.alertModalOpen(this.row);
}
// api.updatePassword(params).then(function(response) {
// var rsp = response.data;
// // var pofo = document.getElementById('oldPw');
//
// if(rsp.retCode == '0000') {
// // vm.chgChkUserId();
// this.row.title = '비밀번호 변경';
// this.row.msg1 = '비밀번호가 정상적으로 변경되었습니다.';
// this.row.msg2 = '변경된 비밀번호로 다시 로그인 해주세요.';
// this.$refs.commonModal.alertModalOpen(this.row);
// // if(vm.ModalOpen('modal16')){
// vm.$router.push({ path: '/login' });
// // }
// } else if(rsp.retCode == '4016') {
// this.row.title = '비밀번호 변경';
// this.row.msg1 = '비밀번호를 확인해주세요.';
// this.$refs.commonModal.alertModalOpen(this.row);
// // vm.ModalOpen('modal14')
// } else if(rsp.retCode == '4017') {
// this.row.title = '비밀번호 오류';
// this.row.msg1 = '비밀번호를 사용할 수 없습니다.';
// this.row.msg2 = '비밀번호는 영문/숫자/특수기호를 혼합하여';
// this.row.msg3 = '8~16자리로 설정해주세요.';
// this.$refs.commonModal.alertModalOpen(this.row);
// // vm.ModalOpen('modal15')
// } else if(rsp.retCode == '4003') {
// this.row.title = '아이디 오류';
// this.row.msg1 = '등록되지 않은 아이디입니다.';
// this.row.msg1 = '아이디를 다시 확인하세요';
// this.$refs.commonModal.alertModalOpen(this.row);
//
// }
// });
} catch(err) {
//alert("실패 하였습니다.");
console.log(err)
this.row.title = '비밀번호 초기화';
this.row.msg1 = '실패 하였습니다.';
this.$refs.commonModal.alertModalOpen(this.row);
return false;
}
},
bytes: function (str) {
var length = ((s,b,i,c) => {
b=0,i=0;
while(1 === 1){
c = s.charCodeAt(i++);
if (isNaN(c)) {
break;
}
b += c >> 11 ? 2 : c >> 7 ? 1 : 1;
}
return b
})(str);
return length;
},
ModalOpen: function(target){
// this.$refs.LoginPopup.ModalOpen(target);
// this.$refs.oldPw.focus(target);
}
}
// api.updatePassword(params).then(function(response) {
// var rsp = response.data;
// // var pofo = document.getElementById('oldPw');
//
// if(rsp.retCode == '0000') {
// // vm.chgChkUserId();
// this.row.title = '비밀번호 변경';
// this.row.msg1 = '비밀번호가 정상적으로 변경되었습니다.';
// this.row.msg2 = '변경된 비밀번호로 다시 로그인 해주세요.';
// this.$refs.commonModal.alertModalOpen(this.row);
// // if(vm.ModalOpen('modal16')){
// vm.$router.push({ path: '/login' });
// // }
// } else if(rsp.retCode == '4016') {
// this.row.title = '비밀번호 변경';
// this.row.msg1 = '비밀번호를 확인해주세요.';
// this.$refs.commonModal.alertModalOpen(this.row);
// // vm.ModalOpen('modal14')
// } else if(rsp.retCode == '4017') {
// this.row.title = '비밀번호 오류';
// this.row.msg1 = '비밀번호를 사용할 수 없습니다.';
// this.row.msg2 = '비밀번호는 영문/숫자/특수기호를 혼합하여';
// this.row.msg3 = '8~16자리로 설정해주세요.';
// this.$refs.commonModal.alertModalOpen(this.row);
// // vm.ModalOpen('modal15')
// } else if(rsp.retCode == '4003') {
// this.row.title = '아이디 오류';
// this.row.msg1 = '등록되지 않은 아이디입니다.';
// this.row.msg1 = '아이디를 다시 확인하세요';
// this.$refs.commonModal.alertModalOpen(this.row);
//
// }
// });
}
},
bytes: function (str) {
var length = ((s,b,i,c) => {
b=0,i=0;
while(1 === 1){
c = s.charCodeAt(i++);
if (isNaN(c)) {
break;
}
b += c >> 11 ? 2 : c >> 7 ? 1 : 1;
}
return b
})(str);
return length;
},
ModalOpen: function(target){
this.$refs.LoginPopup.ModalOpen(target);
this.$refs.oldPw.focus(target);
},
}
}
</script>
</script>