fix: complete first version issue remediation

This commit is contained in:
hectorzhao
2026-07-11 10:14:37 +08:00
parent 709ac97764
commit 208a6c23f8
73 changed files with 1549 additions and 245 deletions
+12 -2
View File
@@ -1,11 +1,13 @@
import { Body, Controller, Get, Post } from '@nestjs/common';
import { Body, Controller, Get, Post, UnauthorizedException } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { CurrentSessionUserId } from './current-session-user.decorator';
import { AuthService, LoginDto } from './auth.service';
import { UsersService } from '../users/users.service';
@ApiTags('auth')
@Controller()
export class AuthController {
constructor(private readonly auth: AuthService) {}
constructor(private readonly auth: AuthService, private readonly users: UsersService) {}
@Get('admin/auth/captcha')
adminCaptcha() {
@@ -26,4 +28,12 @@ export class AuthController {
clientLogin(@Body() body: LoginDto) {
return this.auth.login(body, 'client');
}
@Post('auth/password')
changeOwnPassword(@CurrentSessionUserId() userId: string | undefined, @Body() body: { currentPassword?: string; password?: string }) {
if (!userId) {
throw new UnauthorizedException('登录会话无效,请重新登录');
}
return this.users.changeOwnPassword(userId, body.currentPassword ?? '', body.password ?? '');
}
}