mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
feat(api/private/me): include authProvider in UserInfo
This information is supposed to be used by the frontend to identify the login method that was used. The used login method is saved as a string into the session data and extracted via a new SessionAuthProvider decorator. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
3f8e3b0589
commit
d6ea4d29fe
7 changed files with 71 additions and 8 deletions
|
@ -75,11 +75,18 @@ export class AuthController {
|
|||
@Post('local/login')
|
||||
@OpenApi(201, 400, 401)
|
||||
login(
|
||||
@Req() request: Request & { session: { user: string } },
|
||||
@Req()
|
||||
request: Request & {
|
||||
session: {
|
||||
authProvider: string;
|
||||
user: string;
|
||||
};
|
||||
},
|
||||
@Body() loginDto: LoginDto,
|
||||
): void {
|
||||
// There is no further testing needed as we only get to this point if LocalAuthGuard was successful
|
||||
request.session.user = loginDto.username;
|
||||
request.session.authProvider = 'local';
|
||||
}
|
||||
|
||||
@UseGuards(SessionGuard)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue