|
|
@ -55,7 +55,8 @@ |
|
|
|
]" |
|
|
|
> |
|
|
|
{{ $t("Reset Password") |
|
|
|
}}<span v-if="disableBtn">({{ this.countdown }})</span> |
|
|
|
}} |
|
|
|
<!-- <span v-if="disableBtn">({{ this.countdown }})</span> --> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -129,6 +130,7 @@ |
|
|
|
></span> |
|
|
|
</v-spacer> |
|
|
|
</div> |
|
|
|
<!-- 會員未認證Modal --> |
|
|
|
<v-dialog v-model="dialog" :width="$vuetify.breakpoint.smAndUp ? 423 : 294" |
|
|
|
@click:outside="colseDialog()"> |
|
|
|
<v-card class="tw-p-[30px]" :height="$vuetify.breakpoint.smAndUp ? 289 : 290"> |
|
|
@ -156,6 +158,7 @@ |
|
|
|
</v-btn> --> |
|
|
|
</v-card> |
|
|
|
</v-dialog> |
|
|
|
<!-- 重啟帳號Modal --> |
|
|
|
<v-dialog v-model="deleteDialog" :width="$vuetify.breakpoint.smAndUp ? 423 : 294" |
|
|
|
@click:outside="colseDialog()"> |
|
|
|
<v-card class="tw-p-[30px]" :height="$vuetify.breakpoint.smAndUp ? 289 : 290"> |
|
|
@ -188,6 +191,7 @@ |
|
|
|
</v-btn> --> |
|
|
|
</v-card> |
|
|
|
</v-dialog> |
|
|
|
<!-- 忘記密碼信件Modal --> |
|
|
|
<v-dialog v-model="chackMailDialog" :width="$vuetify.breakpoint.smAndUp ? 463 : 294" |
|
|
|
@click:outside="colseDialog()"> |
|
|
|
<v-card class="tw-p-[30px]" :height="$vuetify.breakpoint.smAndUp ? 289 : 290"> |
|
|
@ -221,7 +225,8 @@ |
|
|
|
</v-btn> --> |
|
|
|
</v-card> |
|
|
|
</v-dialog> |
|
|
|
|
|
|
|
<!-- 認證碼Modal --> |
|
|
|
<VerifyCode @user-verifyCode="userVerifyCode" @resend-mail="resendVerifyEmail" :error="error" :account="userData.Account"></VerifyCode> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -229,10 +234,14 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import VerifyCode from "@/components/newcomponent/modal/VerifyCodeModal.vue"; |
|
|
|
export default { |
|
|
|
name: "Forgot", |
|
|
|
layout: "login", |
|
|
|
auth: false, |
|
|
|
components: { |
|
|
|
VerifyCode |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
showPass: false, |
|
|
@ -272,6 +281,12 @@ export default { |
|
|
|
deleteDialog: false, |
|
|
|
wrongMessageActive: false, |
|
|
|
chackMailDialog: false, |
|
|
|
error: false, |
|
|
|
userInfo: {}, |
|
|
|
user: { |
|
|
|
Account: '', |
|
|
|
Password: '', |
|
|
|
} |
|
|
|
}; |
|
|
|
}, |
|
|
|
created(){ |
|
|
@ -303,17 +318,18 @@ export default { |
|
|
|
vm.getPath = null; |
|
|
|
} |
|
|
|
}, |
|
|
|
//寄送忘記密碼信 |
|
|
|
sendForgotMail() { |
|
|
|
this.countdown = 60; |
|
|
|
this.resendValid = false; |
|
|
|
this.$axios |
|
|
|
.post(`/trending/api/Signup/SendForgotMail?Email=${this.Email}`) |
|
|
|
.then((response) => { |
|
|
|
//console.log(JSON.stringify(response)); |
|
|
|
//console.log(response); |
|
|
|
if(response.data.STATUSCODE == "404"){ |
|
|
|
this.resendValid = false; |
|
|
|
if(response.data.MSG == "0"){ |
|
|
|
this.dialog = true; |
|
|
|
//this.dialog = true; //原先的認證moadl |
|
|
|
this.resendVerifyEmail(); |
|
|
|
this.$modal.show('VerifyCode'); |
|
|
|
}else if(response.data.MSG == "2"){ |
|
|
|
this.deleteDialog = true; |
|
|
|
}else{ |
|
|
@ -321,29 +337,26 @@ export default { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if(response && response.data && response.data.DATA && response.data.DATA.rel){ |
|
|
|
else if(response && response.data && response.data.DATA && response.data.DATA.rel){ |
|
|
|
let data = response.data.DATA.rel |
|
|
|
if(data){ |
|
|
|
this.result = data; |
|
|
|
this.disableBtn = false; |
|
|
|
this.resendValid = false; |
|
|
|
|
|
|
|
|
|
|
|
this.chackMailDialog = true; |
|
|
|
|
|
|
|
this.disableBtn = !this.disableBtn; |
|
|
|
this.timeout = setInterval(() => { |
|
|
|
if (this.countdown > 0) { |
|
|
|
this.countdown--; |
|
|
|
} |
|
|
|
if (this.countdown == 0) { |
|
|
|
this.resendValid = true; |
|
|
|
this.disableBtn = true; |
|
|
|
this.countdown = 60; |
|
|
|
clearInterval(this.timeout); |
|
|
|
// this.timeout = setInterval(() => { |
|
|
|
// if (this.countdown > 0) { |
|
|
|
// this.countdown--; |
|
|
|
// } |
|
|
|
// if (this.countdown == 0) { |
|
|
|
// this.resendValid = true; |
|
|
|
// this.disableBtn = true; |
|
|
|
// this.countdown = 60; |
|
|
|
// clearInterval(this.timeout); |
|
|
|
|
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
// } |
|
|
|
// }, 1000); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
@ -351,6 +364,7 @@ export default { |
|
|
|
console.log(error); |
|
|
|
}); |
|
|
|
}, |
|
|
|
//重設密碼 |
|
|
|
resetUserPass() { |
|
|
|
if ( |
|
|
|
this.userData.Password === this.userConfirmPass && |
|
|
@ -383,35 +397,66 @@ export default { |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
//重寄認證信 |
|
|
|
resendVerifyEmail() { |
|
|
|
this.countdown = 60; |
|
|
|
this.$axios |
|
|
|
.post( |
|
|
|
`/trending/api/Signup/ReSendVerifyMail?Email=${this.Email}` |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
//console.log(JSON.stringify(response)) |
|
|
|
if(response && response.data){ |
|
|
|
|
|
|
|
this.dialog = false; |
|
|
|
this.resendValid = true; |
|
|
|
|
|
|
|
clearInterval(this.timer); |
|
|
|
this.timer = setInterval(() => { |
|
|
|
if (this.countdown > 0) { |
|
|
|
this.countdown--; |
|
|
|
} |
|
|
|
if (this.countdown === 0) { |
|
|
|
clearInterval(this.timer); |
|
|
|
if(response && response.data && response.data.DATA && response.data.DATA.rel){ |
|
|
|
let data = response.data.DATA.rel |
|
|
|
if(data){ |
|
|
|
this.userInfo = data; |
|
|
|
this.resendValid = true; |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((error) => { |
|
|
|
console.log(error); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//認證會員 |
|
|
|
userVerifyCode(value){ |
|
|
|
this.$axios |
|
|
|
.get( |
|
|
|
`/trending/api/Signup/VerifyAccount?OrgID=${this.userInfo.OrgID}&MemberID=${this.userInfo.MemberID}&Code=${value}` |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
//console.log(response); |
|
|
|
if(response.data.STATUSCODE == 200){ |
|
|
|
this.$modal.hide('VerifyCode'); |
|
|
|
this.decrypt(); |
|
|
|
} |
|
|
|
else{ |
|
|
|
this.error = true; |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
}, |
|
|
|
//解密 |
|
|
|
decrypt(){ |
|
|
|
this.$axios |
|
|
|
.post( |
|
|
|
`/trending/api/Signup/DecryptPassword?OrgID=${this.userInfo.OrgID}&Account=${this.userInfo.Account}` |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
//console.log(response); |
|
|
|
if(response && response.data && response.data.DATA && response.data.DATA.rel){ |
|
|
|
let data = response.data.DATA.rel; |
|
|
|
if(data){ |
|
|
|
this.user.Password = data; |
|
|
|
this.Login(); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
}, |
|
|
|
//重啟帳號 |
|
|
|
ReactivateAccount(){ |
|
|
|
this.$axios |
|
|
|
.post( |
|
|
@ -424,7 +469,6 @@ export default { |
|
|
|
if(data){ |
|
|
|
this.deleteDialog = false; |
|
|
|
window.location.href = '/'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
@ -432,7 +476,24 @@ export default { |
|
|
|
console.log(error); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//登入 |
|
|
|
async Login(){ |
|
|
|
this.user.Account = this.userInfo.Account; |
|
|
|
const response = await this.$auth.loginWith('local', { data: this.user }); |
|
|
|
if(response.data.STATUSCODE == 200){ |
|
|
|
let data = response.data.DATA; |
|
|
|
if(data.authtoken){ |
|
|
|
const authtoken = data.authtoken; |
|
|
|
this.$auth.$storage.removeUniversal('authtoken'); |
|
|
|
this.$auth.$storage.setUniversal('authtoken', authtoken); |
|
|
|
let path = this.$auth.$storage.getUniversal('userBeforePath'); |
|
|
|
if(path == "/user"){ |
|
|
|
path = "/"; |
|
|
|
} |
|
|
|
this.$router.push({path: path}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
beforeUnmount() { |
|
|
|
clearInterval(this.timeout); |
|
|
|
xxxxxxxxxx