parse-dashboard 5.1.0-alpha.6 → 5.1.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -173,7 +173,7 @@ module.exports = function(config, options) {
173
173
  }
174
174
 
175
175
  app.get('/login', csrf(), function(req, res) {
176
- const redirectURL = req.url.includes('?redirect=') && req.url.split('?redirect=')[1];
176
+ const redirectURL = req.url.includes('?redirect=') && req.url.split('?redirect=')[1].length > 1 && req.url.split('?redirect=')[1];
177
177
  if (!users || (req.user && req.user.isAuthenticated)) {
178
178
  return res.redirect(`${mountPath}${redirectURL || 'apps'}`);
179
179
  }
@@ -207,7 +207,11 @@ module.exports = function(config, options) {
207
207
  // For every other request, go to index.html. Let client-side handle the rest.
208
208
  app.get('/*', function(req, res) {
209
209
  if (users && (!req.user || !req.user.isAuthenticated)) {
210
- return res.redirect(`${mountPath}login?redirect=${req.url.replace('/login', '')}`);
210
+ const redirect = req.url.replace('/login', '');
211
+ if (redirect.length > 1) {
212
+ return res.redirect(`${mountPath}login?redirect=${redirect}`);
213
+ }
214
+ return res.redirect(`${mountPath}login`);
211
215
  }
212
216
  if (users && req.user && req.user.matchingUsername ) {
213
217
  res.append('username', req.user.matchingUsername);