Make sure that absolute URL is of WEBAPP only (#2624)

This commit is contained in:
Hariom Balhara authored and Omar López committed 2022-05-02 16:21:11 -06:00
1 parent 59c0784cd6
commit a224a46654
6 files changed
+29 -7

No files matched your search

+5 -1
View File
@@ -7,6 +7,7 @@ import { useRouter } from "next/router";
import { useState } from "react";
import { useForm } from "react-hook-form";
import { getSafeRedirectUrl } from "@calcom/lib/getSafeRedirectUrl";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
import { EmailField, Form, PasswordField } from "@calcom/ui/form/fields";
@@ -61,12 +62,15 @@ export default function Login({
let callbackUrl = typeof router.query?.callbackUrl === "string" ? router.query.callbackUrl : "";
// If not absolute URL, make it absolute
if (/"\//.test(callbackUrl)) callbackUrl = callbackUrl.substring(1);
// If not absolute URL, make it absolute
if (!/^https?:\/\//.test(callbackUrl)) {
callbackUrl = `${WEBAPP_URL}/${callbackUrl}`;
}
callbackUrl = getSafeRedirectUrl(callbackUrl);
const LoginFooter = (
<span>
{t("dont_have_an_account")}{" "}