This commit is contained in:
Evert Prants 2022-02-26 14:25:02 +02:00
parent fbadd95c4f
commit 5ec2c33a5b
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -539,15 +539,14 @@ api.post('/set-ip/:domain', domainAuthorization, async (req, res) => {
const checkManaged: RequestHandler = (req, res, next) => { const checkManaged: RequestHandler = (req, res, next) => {
if (!req.body.name || !req.body.password) { if (!req.body.name || !req.body.password) {
return next(new Error('missing_fields')); return next(new Error('Missing name or password'));
} }
// Find user account // Find user account
const findUser = managed.getAccount(req.body.name); const findUser = managed.getAccount(req.body.name);
if (!findUser) { if (!findUser) {
return next(new Error('invalid')); return next(new Error('Invalid name or password'));
} }
console.log(findUser);
// Validate password // Validate password
managed.validatePassword(findUser, req.body.password).then((success) => { managed.validatePassword(findUser, req.body.password).then((success) => {
@ -556,7 +555,7 @@ const checkManaged: RequestHandler = (req, res, next) => {
return next(); return next();
} }
next(new Error('invalid')); next(new Error('Invalid name or password'));
}); });
} }