Add error handling to auto login

This commit is contained in:
Cohee 2024-04-24 00:59:55 +03:00
parent 51014e7a8d
commit 153638c2cd
1 changed files with 7 additions and 3 deletions

View File

@ -263,10 +263,14 @@ app.get('/login', async (request, response) => {
return response.redirect('/');
}
const autoLogin = await userModule.tryAutoLogin(request);
try {
const autoLogin = await userModule.tryAutoLogin(request);
if (autoLogin) {
return response.redirect('/');
if (autoLogin) {
return response.redirect('/');
}
} catch (error) {
console.error('Error during auto-login:', error);
}
return response.sendFile('login.html', { root: path.join(process.cwd(), 'public') });