feat: drone.ci
This commit is contained in:
parent
07c81289bc
commit
5b2c557752
|
@ -67,16 +67,21 @@ export class UserController {
|
|||
*/
|
||||
@Post('/admin/auth')
|
||||
async AdminAuth(@Body() params: UserAdminAuthDTO) {
|
||||
const { username, password } = params;
|
||||
const token = createToken({ hasLogin: true });
|
||||
if (username === 'admin' && password === '123123') {
|
||||
this.ctx.cookies.set(adminSign, token, {
|
||||
expires: new Date(Date.now() + adminSignExpired),
|
||||
httpOnly: false,
|
||||
});
|
||||
return { code: BizCode.OK };
|
||||
} else {
|
||||
return { code: BizCode.ERROR, msg: '用户名密码错误' };
|
||||
try {
|
||||
const { username, password } = params;
|
||||
const token = createToken({ hasLogin: true });
|
||||
if (username === 'admin' && password === '123123') {
|
||||
this.ctx.cookies.set(adminSign, token, {
|
||||
expires: new Date(Date.now() + adminSignExpired),
|
||||
httpOnly: false,
|
||||
});
|
||||
return { code: BizCode.OK };
|
||||
} else {
|
||||
return { code: BizCode.ERROR, msg: '用户名密码错误' };
|
||||
}
|
||||
} catch (error) {
|
||||
this.ctx.logger.error(error);
|
||||
return { code: BizCode.ERROR, msg: error };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user