Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Parse-Dashboard/Authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function initialize(app, options) {
(req,res,next) => {
let redirect = 'apps';
if (req.body.redirect) {
// Strip leading slash from redirect to prevent double slashes
redirect = req.body.redirect.charAt(0) === '/' ? req.body.redirect.substring(1) : req.body.redirect
}
return passport.authenticate('local', {
Expand Down
6 changes: 5 additions & 1 deletion Parse-Dashboard/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,12 @@ You have direct access to the Parse database through function calls, so you can
}

app.get('/login', csrf(), function(req, res) {
const redirectURL = req.url.includes('?redirect=') && req.url.split('?redirect=')[1].length > 1 && req.url.split('?redirect=')[1];
let redirectURL = req.url.includes('?redirect=') && req.url.split('?redirect=')[1].length > 1 && req.url.split('?redirect=')[1];
if (!users || (req.user && req.user.isAuthenticated)) {
// Strip leading slash from redirect to prevent double slashes or malformed URLs
if (redirectURL && redirectURL.charAt(0) === '/') {
redirectURL = redirectURL.substring(1);
}
return res.redirect(`${mountPath}${redirectURL || 'apps'}`);
}

Expand Down
Loading