forked from wangziqi/gongxue-base
chore: commit oxfmt formatting changes and verify artifacts
This commit is contained in:
@@ -9,7 +9,10 @@ import { Public } from './decorators/public.decorator';
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
constructor(private authService: AuthService, private logService: OperationLogsService) {}
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private logService: OperationLogsService,
|
||||
) {}
|
||||
|
||||
@Public()
|
||||
@Post('login')
|
||||
@@ -19,17 +22,24 @@ export class AuthController {
|
||||
try {
|
||||
const result = await this.authService.login(dto, ipAddress);
|
||||
await this.logService.log({
|
||||
userId: result.user.id, username: result.user.username,
|
||||
module: '认证', action: '登录成功',
|
||||
ipAddress, userAgent, status: 'success',
|
||||
userId: result.user.id,
|
||||
username: result.user.username,
|
||||
module: '认证',
|
||||
action: '登录成功',
|
||||
ipAddress,
|
||||
userAgent,
|
||||
status: 'success',
|
||||
});
|
||||
return result;
|
||||
} catch (e: any) {
|
||||
await this.logService.log({
|
||||
username: dto.username,
|
||||
module: '认证', action: '登录失败',
|
||||
module: '认证',
|
||||
action: '登录失败',
|
||||
detail: e.message || '密码错误',
|
||||
ipAddress, userAgent, status: 'fail',
|
||||
ipAddress,
|
||||
userAgent,
|
||||
status: 'fail',
|
||||
});
|
||||
throw e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user