|
@@ -1,6 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { useRouter } from 'vue-router'
|
|
import { useRouter } from 'vue-router'
|
|
|
-import { useUserStore } from '@/stores/modules/user'
|
|
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
const loginForm = ref({
|
|
const loginForm = ref({
|
|
@@ -16,8 +15,6 @@ const loginError: any = ref({
|
|
|
confirmPassword: false
|
|
confirmPassword: false
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const userStore = useUserStore()
|
|
|
|
|
-
|
|
|
|
|
const handleChangePwd = () => {
|
|
const handleChangePwd = () => {
|
|
|
$api
|
|
$api
|
|
|
.resetPwd({
|
|
.resetPwd({
|
|
@@ -27,35 +24,7 @@ const handleChangePwd = () => {
|
|
|
})
|
|
})
|
|
|
.then((res: any) => {
|
|
.then((res: any) => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
- const { data } = res
|
|
|
|
|
- if (data.msg === 'today') {
|
|
|
|
|
- ElMessageBox.alert('Your password will expire today, please reset', 'Prompt', {
|
|
|
|
|
- confirmButtonText: 'OK',
|
|
|
|
|
- type: 'warning',
|
|
|
|
|
- confirmButtonClass: 'el-button--dark'
|
|
|
|
|
- })
|
|
|
|
|
- } else if (data.msg === 'last') {
|
|
|
|
|
- ElMessageBox.alert(
|
|
|
|
|
- `Your password will expire in${data.data}days, please reset`,
|
|
|
|
|
- 'Prompt',
|
|
|
|
|
- {
|
|
|
|
|
- confirmButtonText: 'OK',
|
|
|
|
|
- type: 'warning',
|
|
|
|
|
- confirmButtonClass: 'el-button--dark'
|
|
|
|
|
- }
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- userStore.setUsername(res.data.uname || '')
|
|
|
|
|
- router.push('/')
|
|
|
|
|
- } else if (res.code === 400) {
|
|
|
|
|
- // 验证码错误
|
|
|
|
|
- if (res.data.msg === 'password_error') {
|
|
|
|
|
- loginError.value.password = true
|
|
|
|
|
- } else if (res.data.msg === 'verifcation_error') {
|
|
|
|
|
- loginError.value.code = true
|
|
|
|
|
- } else if (res.data.msg === 'error_times') {
|
|
|
|
|
- errorTipsRef.value.openDialog()
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ console.log(res)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -78,106 +47,129 @@ const emit = defineEmits<{
|
|
|
}>()
|
|
}>()
|
|
|
const handleForgot = () => {
|
|
const handleForgot = () => {
|
|
|
emit('changeStatus', 'reset')
|
|
emit('changeStatus', 'reset')
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ name: 'Login',
|
|
|
|
|
+ query: {
|
|
|
|
|
+ status: 'reset'
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
const handleBackLogin = () => {
|
|
const handleBackLogin = () => {
|
|
|
emit('changeStatus', 'login')
|
|
emit('changeStatus', 'login')
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ name: 'Login',
|
|
|
|
|
+ query: {
|
|
|
|
|
+ status: 'login'
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-const errorTipsRef = ref()
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
|
- <el-card class="login-card">
|
|
|
|
|
- <div class="title">
|
|
|
|
|
- <span class="welcome">Change Password</span>
|
|
|
|
|
- <span class="tips">Password expired, please change your password.</span>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <div class="login-form">
|
|
|
|
|
- <div class="label">
|
|
|
|
|
- <span>User Name</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <el-input :disabled="true" ref="userNameRef" v-model="loginForm.username" class="user-name">
|
|
|
|
|
- <template #prefix>
|
|
|
|
|
- <span class="font_family icon-icon_username_b"></span>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #suffix>
|
|
|
|
|
- <span v-if="isUserNameExit" class="font_family icon-icon_confirm_b confirm-icon"></span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-input>
|
|
|
|
|
- <div class="label">
|
|
|
|
|
- <span>Old Password</span>
|
|
|
|
|
- <span class="forgot-password" @click="handleForgot">Forgot Password?</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <el-input
|
|
|
|
|
- ref="passWordRef"
|
|
|
|
|
- :class="{ 'is-error': loginError.oldPassword }"
|
|
|
|
|
- v-model="loginForm.oldPassword"
|
|
|
|
|
- type="password"
|
|
|
|
|
- placeholder="Please input password"
|
|
|
|
|
- show-password
|
|
|
|
|
- @focus="hiddenError('oldPassword')"
|
|
|
|
|
- >
|
|
|
|
|
- <template #prefix>
|
|
|
|
|
- <span class="font_family icon-icon_password_b"></span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-input>
|
|
|
|
|
- <div class="error" v-if="loginError.oldPassword">Incorrect password. Please try again.</div>
|
|
|
|
|
- <div class="label">
|
|
|
|
|
- <span>New Password</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <el-input
|
|
|
|
|
- ref="passWordRef"
|
|
|
|
|
- :class="{ 'is-error': loginError.newPassword }"
|
|
|
|
|
- v-model="loginForm.newPassword"
|
|
|
|
|
- type="password"
|
|
|
|
|
- placeholder="Please input password"
|
|
|
|
|
- show-password
|
|
|
|
|
- @focus="hiddenError('newPassword')"
|
|
|
|
|
- >
|
|
|
|
|
- <template #prefix>
|
|
|
|
|
- <span class="font_family icon-icon_password_b"></span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-input>
|
|
|
|
|
- <div class="error" v-if="loginError.newPassword">Incorrect password. Please try again.</div>
|
|
|
|
|
- <div class="label">
|
|
|
|
|
- <span>Confirm New Password</span>
|
|
|
|
|
|
|
+ <div class="login">
|
|
|
|
|
+ <el-card class="login-card">
|
|
|
|
|
+ <div class="title">
|
|
|
|
|
+ <span class="welcome">Change Password</span>
|
|
|
|
|
+ <span class="tips">Password expired, please change your password.</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <el-input
|
|
|
|
|
- ref="passWordRef"
|
|
|
|
|
- :class="{ 'is-error': loginError.confirmPassword }"
|
|
|
|
|
- v-model="loginForm.confirmPassword"
|
|
|
|
|
- type="password"
|
|
|
|
|
- placeholder="Please input password"
|
|
|
|
|
- show-password
|
|
|
|
|
- @focus="hiddenError('confirmPassword')"
|
|
|
|
|
- @blur="confirmPwd"
|
|
|
|
|
- >
|
|
|
|
|
- <template #prefix>
|
|
|
|
|
- <span class="font_family icon-icon_password_b"></span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-input>
|
|
|
|
|
- <div class="error" v-if="loginError.confirmPassword">
|
|
|
|
|
- The password does not match. Please try again.
|
|
|
|
|
- </div>
|
|
|
|
|
- <el-button @click="handleChangePwd" class="el-button--dark login-btn"
|
|
|
|
|
- >Change Password</el-button
|
|
|
|
|
- >
|
|
|
|
|
- <div @click="handleBackLogin" class="back-text">
|
|
|
|
|
- <span class="font_family icon-icon_back_b"></span>
|
|
|
|
|
- <span class="text"> Back to login</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <template #footer>
|
|
|
|
|
- <div class="license">
|
|
|
|
|
- <span>© 2024 KTreker from <span class="company">Kerry Logistics</span></span>
|
|
|
|
|
- <span>Version 0.67</span>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <div class="login-form">
|
|
|
|
|
+ <div class="label">
|
|
|
|
|
+ <span>User Name</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-input :disabled="true" ref="userNameRef" v-model="loginForm.username" class="user-name">
|
|
|
|
|
+ <template #prefix>
|
|
|
|
|
+ <span class="font_family icon-icon_username_b"></span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #suffix>
|
|
|
|
|
+ <span v-if="isUserNameExit" class="font_family icon-icon_confirm_b confirm-icon"></span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <div class="label">
|
|
|
|
|
+ <span>Old Password</span>
|
|
|
|
|
+ <span class="forgot-password" @click="handleForgot">Forgot Password?</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ ref="passWordRef"
|
|
|
|
|
+ :class="{ 'is-error': loginError.oldPassword }"
|
|
|
|
|
+ v-model="loginForm.oldPassword"
|
|
|
|
|
+ type="password"
|
|
|
|
|
+ placeholder="Please input password"
|
|
|
|
|
+ show-password
|
|
|
|
|
+ @focus="hiddenError('oldPassword')"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #prefix>
|
|
|
|
|
+ <span class="font_family icon-icon_password_b"></span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <div class="error" v-if="loginError.oldPassword">Incorrect password. Please try again.</div>
|
|
|
|
|
+ <div class="label">
|
|
|
|
|
+ <span>New Password</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ ref="passWordRef"
|
|
|
|
|
+ :class="{ 'is-error': loginError.newPassword }"
|
|
|
|
|
+ v-model="loginForm.newPassword"
|
|
|
|
|
+ type="password"
|
|
|
|
|
+ placeholder="Please input password"
|
|
|
|
|
+ show-password
|
|
|
|
|
+ @focus="hiddenError('newPassword')"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #prefix>
|
|
|
|
|
+ <span class="font_family icon-icon_password_b"></span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <div class="error" v-if="loginError.newPassword">Incorrect password. Please try again.</div>
|
|
|
|
|
+ <div class="label">
|
|
|
|
|
+ <span>Confirm New Password</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ ref="passWordRef"
|
|
|
|
|
+ :class="{ 'is-error': loginError.confirmPassword }"
|
|
|
|
|
+ v-model="loginForm.confirmPassword"
|
|
|
|
|
+ type="password"
|
|
|
|
|
+ placeholder="Please input password"
|
|
|
|
|
+ show-password
|
|
|
|
|
+ @focus="hiddenError('confirmPassword')"
|
|
|
|
|
+ @blur="confirmPwd"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #prefix>
|
|
|
|
|
+ <span class="font_family icon-icon_password_b"></span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <div class="error" v-if="loginError.confirmPassword">
|
|
|
|
|
+ The password does not match. Please try again.
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-button @click="handleChangePwd" class="el-button--dark login-btn"
|
|
|
|
|
+ >Change Password</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ <div @click="handleBackLogin" class="back-text">
|
|
|
|
|
+ <span class="font_family icon-icon_back_b"></span>
|
|
|
|
|
+ <span class="text"> Back to login</span>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- </template>
|
|
|
|
|
- </el-card>
|
|
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <div class="license">
|
|
|
|
|
+ <span>© 2024 KTreker from <span class="company">Kerry Logistics</span></span>
|
|
|
|
|
+ <span>Version 0.67</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
|
+.login {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ background: url(../image/bg-image.png) no-repeat center center;
|
|
|
|
|
+ background-size: cover;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
.login-card {
|
|
.login-card {
|
|
|
width: 400px;
|
|
width: 400px;
|
|
|
|
|
|