diff --git a/back/services/user.ts b/back/services/user.ts index 9f3a7448..2b608f60 100644 --- a/back/services/user.ts +++ b/back/services/user.ts @@ -228,6 +228,9 @@ export default class UserService { username: string; password: string; }) { + if (password === 'admin') { + return { code: 400, message: '密码不能设置为admin' }; + } const authInfo = this.getAuthInfo(); this.updateAuthInfo(authInfo, { username, password }); return { code: 200, message: '更新成功' }; diff --git a/src/pages/initialization/index.tsx b/src/pages/initialization/index.tsx index 9e060dfd..fce2e8e9 100644 --- a/src/pages/initialization/index.tsx +++ b/src/pages/initialization/index.tsx @@ -153,7 +153,13 @@ const Initialization = () => {