mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
Set the session cookie after registering
Fix https://github.com/hedgedoc/react-client/issues/2524 Signed-off-by: Tamotsu Takahashi <ttakah+github@gmail.com>
This commit is contained in:
parent
35f7274b7f
commit
396050c6cf
1 changed files with 6 additions and 1 deletions
|
@ -54,13 +54,18 @@ export class AuthController {
|
|||
@UseGuards(RegistrationEnabledGuard)
|
||||
@Post('local')
|
||||
@OpenApi(201, 400, 409)
|
||||
async registerUser(@Body() registerDto: RegisterDto): Promise<void> {
|
||||
async registerUser(
|
||||
@Req() request: RequestWithSession,
|
||||
@Body() registerDto: RegisterDto,
|
||||
): Promise<void> {
|
||||
const user = await this.usersService.createUser(
|
||||
registerDto.username,
|
||||
registerDto.displayName,
|
||||
);
|
||||
// ToDo: Figure out how to rollback user if anything with this calls goes wrong
|
||||
await this.identityService.createLocalIdentity(user, registerDto.password);
|
||||
request.session.user = registerDto.username;
|
||||
request.session.authProvider = 'local';
|
||||
}
|
||||
|
||||
@UseGuards(LoginEnabledGuard, SessionGuard)
|
||||
|
|
Loading…
Reference in a new issue