Skip to content

Commit

Permalink
include the settings on the acount info endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmanos committed Oct 23, 2024
1 parent b0fc5da commit 0f17ff7
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/routers/user.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ userController.get('/account-info', async (req: Request, res: Response) => {
username: user.username,
displayName: user.displayName,
hasPassword: user.passwordHash !== null,
settings: {
openidRefreshTokenMaxAgeInSeconds: user.openidRefreshTokenMaxAgeInSeconds,
},
webauthnCredentials: (user.webauthnCredentials || []).map(cred => ({
createTime: cred.createTime,
credentialId: cred.credentialId,
Expand Down Expand Up @@ -597,21 +600,6 @@ userController.delete('/', async (req: Request, res: Response) => {
}
});

userController.get('/settings', async (req: Request, res: Response) => {
try {
const userRes = await getUser(req.user.id);
if (userRes.ok) {
const user = userRes.unwrap();
return res.send({
openidRefreshTokenMaxAgeInSeconds: user.openidRefreshTokenMaxAgeInSeconds,
})
}
return res.status(400).send({ error: userRes.err });
}
catch (err) {
return res.status(500).send({ error: err });
}
});

userController.post('/settings', async (req: Request, res: Response) => {
try {
Expand Down

0 comments on commit 0f17ff7

Please sign in to comment.