diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index e3cfd442..32b30cbd 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -502,6 +502,7 @@ export default { 'Log Errors': '日志错误', 'No Expire': '不过期', 'Log Expire Duration': '日志过期时间', + 'Change Password': '更改密码', // 挑战 'Challenge': '挑战', @@ -677,6 +678,8 @@ export default { 'Enabled successfully': '成功启用', 'Disabled successfully': '成功禁用', 'Request Error': '请求错误', + 'Changed password successfully': '成功修改密码', + 'Two passwords do not match': '两次密码不匹配', // 其他 'Star crawlab-team/crawlab on GitHub': '在 GitHub 上为 Crawlab 加星吧' diff --git a/frontend/src/views/setting/Setting.vue b/frontend/src/views/setting/Setting.vue index ff0e98a3..d8986e54 100644 --- a/frontend/src/views/setting/Setting.vue +++ b/frontend/src/views/setting/Setting.vue @@ -48,9 +48,6 @@ - - - + + + + + + + + + + +
+ + {{ $t('Save') }} + +
+
+
+
+ + { + if (!valid) return + if (this.userInfo.password !== this.userInfo.confirm_password) { + this.$message.error(this.$t('Two passwords do not match')) + return + } + if (this.userInfo.password.length < 5) { + this.$message.error(this.$t('Password length should be no shorter than 5')) + return + } + const res = await this.$request.post(`/me/change-password`, { + password: this.userInfo.password + }) + if (!res.data.error) { + this.$message.success(this.$t('Changed password successfully')) + } + }) } } }