Skip to content

Commit 10142cc

Browse files
committed
fix
1 parent 043850b commit 10142cc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Parse-Dashboard/Authentication.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ function initialize(app, options) {
7777
(req,res,next) => {
7878
let redirect = 'apps';
7979
if (req.body.redirect) {
80+
// Strip leading slash from redirect to prevent double slashes
8081
redirect = req.body.redirect.charAt(0) === '/' ? req.body.redirect.substring(1) : req.body.redirect
8182
}
8283
return passport.authenticate('local', {

Parse-Dashboard/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,8 +1062,12 @@ You have direct access to the Parse database through function calls, so you can
10621062
}
10631063

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

0 commit comments

Comments
 (0)