mirror of
https://github.com/docmost/docmost.git
synced 2025-11-14 02:21:16 +10:00
feat(backend): forgot password (#250)
* feat(backend): forgot password * feat: apply feedback from code review * chore(auth): validate the minimum length of 'newPassword' * chore(auth): make token has an expiry of 1 hour * chore: rename all occurrences of 'code' to 'token' * chore(backend): provide value on nanoIdGen method
This commit is contained in:
@ -19,6 +19,7 @@ import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { ForgotPasswordDto } from './dto/forgot-password.dto';
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
@ -33,6 +34,18 @@ export class AuthController {
|
||||
return this.authService.login(loginInput, req.raw.workspaceId);
|
||||
}
|
||||
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('forgot-password')
|
||||
async forgotPassword(
|
||||
@Req() req,
|
||||
@Body() forgotPasswordDto: ForgotPasswordDto,
|
||||
) {
|
||||
return this.authService.forgotPassword(
|
||||
forgotPasswordDto,
|
||||
req.raw.workspaceId,
|
||||
);
|
||||
}
|
||||
|
||||
/* @HttpCode(HttpStatus.OK)
|
||||
@Post('register')
|
||||
async register(@Req() req, @Body() createUserDto: CreateUserDto) {
|
||||
|
||||
Reference in New Issue
Block a user