fix(api): only use homeLocation as a fallback (#40517)

This commit is contained in:
Oliver Eyton-Williams
2020-12-30 20:10:38 +01:00
committed by Mrugesh Mohapatra
parent 03fa21a565
commit a076547d43
22 changed files with 207 additions and 600 deletions

View File

@@ -13,9 +13,9 @@ import { jwtSecret } from '../../config/secrets';
import {
getReturnTo,
getRedirectBase,
getParamsFromReq,
getRedirectParams,
isRootPath
} from './utils/get-return-to';
} from './utils/redirection';
const passportOptions = {
emailOptional: true,
@@ -86,7 +86,7 @@ export const devSaveResponseAuthCookies = () => {
export const devLoginRedirect = () => {
return (req, res) => {
// this mirrors the production approach, but without any validation
let { returnTo, origin, pathPrefix } = getParamsFromReq(req);
let { returnTo, origin, pathPrefix } = getRedirectParams(req);
returnTo += isRootPath(getRedirectBase(origin, pathPrefix), returnTo)
? '/learn'
: '';