mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-02-05 15:29:35 +08:00
Fix: create user password rule
This commit is contained in:
parent
01c8f26cf7
commit
184639ef73
@ -19,10 +19,7 @@ router.post(
|
||||
const userName = String(ctx.request.body.username);
|
||||
const passWord = String(ctx.request.body.password);
|
||||
const permission = Number(ctx.request.body.permission);
|
||||
if (userName.length < 2 || userName.length > 18)
|
||||
throw new Error($t("router.user.invalidUserName"));
|
||||
if (passWord.length < 6 || passWord.length > 18)
|
||||
throw new Error($t("router.user.invalidPassword"));
|
||||
if (!userSystem.validatePassword(passWord)) throw new Error($t("router.user.invalidPassword"));
|
||||
if (userSystem.existUserName(userName)) throw new Error($t("router.user.existsUserName"));
|
||||
const result = register(ctx, userName, passWord, permission);
|
||||
ctx.body = result;
|
||||
|
@ -171,9 +171,11 @@ router.all(
|
||||
try {
|
||||
const serviceUuid = String(ctx.query.remote_uuid);
|
||||
const instanceUuid = String(ctx.query.uuid);
|
||||
const parameter = ctx.body;
|
||||
const remoteService = RemoteServiceSubsystem.getInstance(serviceUuid);
|
||||
const result = await new RemoteRequest(remoteService).request("instance/stop_asynchronous", {
|
||||
instanceUuid
|
||||
instanceUuid,
|
||||
parameter
|
||||
});
|
||||
ctx.body = result;
|
||||
} catch (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user