Skip to content

Commit

Permalink
"Changed error handling in Discord auth route to redirect to root wit…
Browse files Browse the repository at this point in the history
…h error query param instead of rendering index with error message."
  • Loading branch information
AlphaNodesDev committed Aug 16, 2024
1 parent 47951c2 commit 1571a62
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/routes/discordAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ app.get('/discord', checkWhitelist, (req, res) => {
db.get('SELECT * FROM users WHERE email = ?', [email], async (dbErr, row) => {
if (dbErr) {
logErrorToFile(`Error retrieving user details: ${dbErr.message}`);
return res.render('index', { error: 'An error occurred while retrieving user details.' });
return res.redirect('/?error=An error occurred while retrieving user details.');
}

if (row && row.status === 1) {
Expand All @@ -178,8 +178,8 @@ app.get('/discord', checkWhitelist, (req, res) => {
req.session.user = row;
res.redirect('/dashboard');
} else {
res.redirect('/?error=Your account is restricted or timed out by admin.');
logNormalToFile(`User account is restricted: ${email}`);
res.render('index', { error: 'Your account is restricted or timed out by admin.' });
}
});

Expand Down

0 comments on commit 1571a62

Please sign in to comment.