Skip to content

The open source simple and complete warehouse management system is derived from our many years of experience in implementing erp projects. We stripped the original commercial system wms function and opened it up for free, hoping to help the majority of small and medium-sized enterprises. At present, the system supports cross-platform。

feat(System): Add change password

liufu51e8e72b549a
diff --git a/frontend/src/components/system/change-pwd.vue b/frontend/src/components/system/change-pwd.vue
new file mode 100644
index 0000000..0a3291a
--- /dev/null
+++ b/frontend/src/components/system/change-pwd.vue
@@ -0,0 +1,165 @@
+<template>
+ <v-dialog v-model="data.isShow" :width="'30%'" transition="dialog-top-transition" :persistent="true">
+ <template #default>
+ <v-card class="formCard">
+ <v-toolbar color="white" :title="`${$t('system.homeHeader.changePwd')}`"></v-toolbar>
+ <v-card-text>
+ <v-form ref="formRef">
+ <v-text-field
+ v-model="data.form.old_password"
+ :label="$t('system.homeHeader.oldPwd')"
+ :rules="data.rules.old_password"
+ variant="outlined"
+ :autocomplete="false"
+ :append-inner-icon="data.showPassword_old ? 'mdi-eye' : 'mdi-eye-off'"
+ :type="data.showPassword_old ? 'text' : 'password'"
+ @click:append-inner="method.handleShowPassword('old')"
+ ></v-text-field>
+ <v-text-field
+ v-model="data.form.new_password"
+ :label="$t('system.homeHeader.newPwd')"
+ :rules="data.rules.new_password"
+ variant="outlined"
+ :autocomplete="false"
+ :append-inner-icon="data.showPassword_new ? 'mdi-eye' : 'mdi-eye-off'"
+ :type="data.showPassword_new ? 'text' : 'password'"
+ @click:append-inner="method.handleShowPassword('new')"
+ ></v-text-field>
+ <v-text-field
+ v-model="data.form.confirm_new_password"
+ :label="$t('system.homeHeader.confrimNewPwd')"
+ :rules="data.rules.confirm_new_password"
+ variant="outlined"
+ :autocomplete="false"
+ :append-inner-icon="data.showPassword_confirm ? 'mdi-eye' : 'mdi-eye-off'"
+ :type="data.showPassword_confirm ? 'text' : 'password'"
+ @click:append-inner="method.handleShowPassword('confirm')"
+ ></v-text-field>
+ </v-form>
+ </v-card-text>
+ <v-card-actions class="justify-end">
+ <v-btn variant="text" @click="method.close">{{ $t('system.page.close') }}</v-btn>
+ <v-btn color="primary" variant="text" @click="method.submit">{{ $t('system.page.submit') }}</v-btn>
+ </v-card-actions>
+ </v-card>
+ </template>
+ </v-dialog>
+</template>
+
+<script lang="ts" setup>
+import { reactive, ref } from 'vue'
+import { Md5 } from 'ts-md5'
+import i18n from '@/languages/i18n'
+import { hookComponent } from '@/components/system/index'
+import { changePassword } from '@/api/base/userManagement'
+import { store } from '@/store'
+
+const formRef = ref()
+
+const data = reactive({
+ isShow: false,
+ showPassword_old: false,
+ showPassword_new: false,
+ showPassword_confirm: false,
+ form: {
+ old_password: '',
+ new_password: '',
+ confirm_new_password: ''
+ },
+ rules: {
+ old_password: [(val: string) => !!val || `${ i18n.global.t('system.checkText.mustInput') }${ i18n.global.t('system.homeHeader.oldPwd') }!`],
+ new_password: [(val: string) => !!val || `${ i18n.global.t('system.checkText.mustInput') }${ i18n.global.t('system.homeHeader.newPwd') }!`],
+ confirm_new_password: [
+ (val: string) => !!val || `${ i18n.global.t('system.checkText.mustInput') }${ i18n.global.t('system.homeHeader.confrimNewPwd') }!`,
+ (val: string) => method.verifyPwd(val)
+ ]
+ }
+})
+
+const method = reactive({
+ handleShowPassword: (flag: string) => {
+ switch (flag) {
+ case 'old':
+ data.showPassword_old = !data.showPassword_old
+ break
+ case 'new':
+ data.showPassword_new = !data.showPassword_new
+ break
+ case 'confirm':
+ data.showPassword_confirm = !data.showPassword_confirm
+ break
+ }
+ },
+ open: () => {
+ data.form = {
+ old_password: '',
+ new_password: '',
+ confirm_new_password: ''
+ }
+ data.isShow = true
+ },
+ close: () => {
+ data.isShow = false
+ },
+ submit: async () => {
+ const { valid } = await formRef.value.validate()
+ if (valid) {
+ const user = store.getters['user/userInfo']
+ const form = JSON.parse(
+ JSON.stringify({
+ id: user.user_id,
+ old_password: Md5.hashStr(data.form.old_password),
+ new_password: Md5.hashStr(data.form.new_password)
+ })
+ )
+ const { data: res } = await changePassword(form)
+ if (!res.isSuccess) {
+ hookComponent.$message({
+ type: 'error',
+ content: res.errorMessage
+ })
+ return
+ }
+ hookComponent.$message({
+ type: 'success',
+ content: `${ i18n.global.t('system.page.submit') }${ i18n.global.t('system.tips.success') }`
+ })
+ // Get remember username and password
+ const rememberJSON = localStorage.getItem('userLoginInfo')
+ if (rememberJSON) {
+ const rememberJSON = JSON.stringify({
+ userName: window.btoa(encodeURIComponent(user.user_name)),
+ password: window.btoa(encodeURIComponent(data.form.new_password))
+ })
+ localStorage.setItem('userLoginInfo', rememberJSON)
+ }
+ method.close()
+ } else {
+ hookComponent.$message({
+ type: 'error',
+ content: i18n.global.t('system.checkText.checkFormFail')
+ })
+ }
+ },
+ // Verify whether the passwords are the same
+ verifyPwd: (val: string) => {
+ if (val !== data.form.new_password) {
+ return i18n.global.t('system.tips.verifyPwd')
+ }
+ return true
+ }
+})
+
+defineExpose({
+ open: method.open,
+ close: method.close
+})
+</script>
+
+<style scoped lang="less">
+.v-form {
+ div {
+ margin-bottom: 7px;
+ }
+}
+</style>
diff --git a/frontend/src/languages/langs/cnZh.ts b/frontend/src/languages/langs/cnZh.ts
index 32d2a8b..1347422 100644
--- a/frontend/src/languages/langs/cnZh.ts
+++ b/frontend/src/languages/langs/cnZh.ts
@@ -39,7 +39,8 @@ export default {
beforeAsnSorted: '确认分拣完成?',
requestTimeout: '请求超时!',
requestFail: '接口请求失败,请重试',
- vaildEmail: '请输入正确的邮箱格式!'
+ vaildEmail: '请输入正确的邮箱格式!',
+ verifyPwd: '校验失败, 新密码与确认新密码不同!'
},
checkText: {
checkFormFail: '操作失败, 请检查数据后重试!',
@@ -53,7 +54,11 @@ export default {
lengthValid: '字段长度应该在'
},
homeHeader: {
- logout: '注销'
+ logout: '注销',
+ changePwd: '修改密码',
+ oldPwd: '旧密码',
+ newPwd: '新密码',
+ confrimNewPwd: '确认新密码'
},
combobox: {
sex: {
diff --git a/frontend/src/languages/langs/enUs.ts b/frontend/src/languages/langs/enUs.ts
index 0e182c4..fcfab83 100644
--- a/frontend/src/languages/langs/enUs.ts
+++ b/frontend/src/languages/langs/enUs.ts
@@ -39,7 +39,8 @@ export default {
beforeAsnSorted: 'Confirm Sorted?',
requestTimeout: 'Request Timeout!',
requestFail: 'Request fail.Please try it again',
- vaildEmail: 'Please enter the correct email format!'
+ vaildEmail: 'Please enter the correct email format!',
+ verifyPwd: 'Verification failed. The new password is different from the confirmed one!'
},
checkText: {
checkFormFail: 'Operation failed. Please check the data and try again!',
@@ -53,7 +54,11 @@ export default {
lengthValid: 'The length should be between '
},
homeHeader: {
- logout: 'Logout'
+ logout: 'Logout',
+ changePwd: 'Change Password',
+ oldPwd: 'Old password',
+ newPwd: 'New password',
+ confrimNewPwd: 'Confirm new password'
},
combobox: {
sex: {
diff --git a/frontend/src/view/base/warehouseSetting/add-or-update-location.vue b/frontend/src/view/base/warehouseSetting/add-or-update-location.vue
index 6dee3d9..c29c990 100644
--- a/frontend/src/view/base/warehouseSetting/add-or-update-location.vue
+++ b/frontend/src/view/base/warehouseSetting/add-or-update-location.vue
@@ -288,7 +288,7 @@ const method = reactive({
for (const item of res.data) {
data.combobox.warehouse_name.push({
label: item.name,
- // WarehouseID is a numberic type
+ // WarehouseID is a numeric type
value: Number(item.value)
})
}
diff --git a/frontend/src/view/home/homeHeader.vue b/frontend/src/view/home/homeHeader.vue
index be33261..e102e5d 100644
--- a/frontend/src/view/home/homeHeader.vue
+++ b/frontend/src/view/home/homeHeader.vue
@@ -9,10 +9,10 @@
</div>
<div class="toolsBar">
<div class="gitSrc mr-4">
- <img src="@/assets/img/gitee.png" alt="Gitee" @click="method.toGit('gitee')">
+ <img src="@/assets/img/gitee.png" alt="Gitee" @click="method.toGit('gitee')" />
</div>
<div class="gitSrc mr-4">
- <img src="@/assets/img/github.png" alt="Gitee" @click="method.toGit('github')">
+ <img src="@/assets/img/github.png" alt="Gitee" @click="method.toGit('github')" />
</div>
<LanguagesSwitch />
<v-menu>
@@ -29,11 +29,12 @@
</v-list>
</v-menu>
</div>
+ <ChangePwd ref="ChangePwdRef" />
</div>
</template>
<script lang="ts" setup>
-import { reactive, watch, computed } from 'vue'
+import { reactive, watch, computed, ref } from 'vue'
import { useRouter } from 'vue-router'
import LanguagesSwitch from '@/components/system/languages.vue'
import { lightGrey } from '@/constant/style'
@@ -41,13 +42,19 @@ import i18n from '@/languages/i18n'
import { router } from '@/router'
import { store } from '@/store'
import { DataProps } from '@/types/Home/HomeHeader'
+import ChangePwd from '@/components/system/change-pwd.vue'
const routerInfo = useRouter()
+const ChangePwdRef = ref()
const data: DataProps = reactive({
breadcrumbItems: [],
// User Action List
userOperationMenu: [
+ {
+ title: i18n.global.t('system.homeHeader.changePwd'),
+ value: 'changePwd'
+ },
{
title: i18n.global.t('system.homeHeader.logout'),
value: 'logout'
@@ -87,6 +94,8 @@ const method = reactive({
store.commit('system/setCurrentRouterPath', '')
router.push('/login')
+ } else if (value === 'changePwd') {
+ ChangePwdRef.value.open()
}
},
toGit: (type: string) => {
@@ -217,7 +226,7 @@ const firstName = computed(() => {
}
}
-.firstName{
+.firstName {
font-weight: 600;
color: #9c27b0;
}
diff --git a/frontend/src/view/login/login.vue b/frontend/src/view/login/login.vue
index 44625f5..cc007f1 100644
--- a/frontend/src/view/login/login.vue
+++ b/frontend/src/view/login/login.vue
@@ -10,7 +10,7 @@
</div>
<LoginForm />
</div>
-
+
<div class="copyRight">
<a href="https://modernwms.ikeyly.com" target="_blank">CopyRight © 2023 ModernWMS All Rights Reserve</a>
</div>
diff --git a/frontend/src/view/warehouseWorking/warehouseMove/add-or-update-move.vue b/frontend/src/view/warehouseWorking/warehouseMove/add-or-update-move.vue
index afa0b92..fd2e9a0 100644
--- a/frontend/src/view/warehouseWorking/warehouseMove/add-or-update-move.vue
+++ b/frontend/src/view/warehouseWorking/warehouseMove/add-or-update-move.vue
@@ -3,7 +3,7 @@
<v-dialog v-model="isShow" :width="'30%'" transition="dialog-top-transition" :persistent="true">
<template #default>
<v-card>
- <v-toolbar class="" color="white" :title="`${$t('router.sideBar.warehouseMove')}`">
+ <v-toolbar color="white" :title="`${$t('router.sideBar.warehouseMove')}`">
<custom-qrcode :value="qrCodeValue" />
</v-toolbar>
<v-card-text>
@@ -91,6 +91,7 @@
@close="method.closeCommodityDialogSelect"
@sureSelect="method.sureSelectCommodity"
/>
+
<location-select :show-dialog="data.showLocationDialogSelect" @close="method.closeLocationDialogSelect" @sureSelect="method.sureSelectLocation" />
</template>