Fix hubspot callback (#3195)

Co-authored-by: Leo Giovanetti <hello@leog.me>
pull/3187/head
Hariom Balhara 2022-06-30 07:01:07 +00:00 committed by GitHub
parent 53bbbf793d
commit 1469b856a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -71,7 +71,9 @@ export default function Login({
callbackUrl = `${WEBAPP_URL}/${callbackUrl}`;
}
callbackUrl = getSafeRedirectUrl(callbackUrl);
const safeCallbackUrl = getSafeRedirectUrl(callbackUrl);
callbackUrl = safeCallbackUrl || "";
const LoginFooter = (
<span>

View File

@ -1,7 +1,10 @@
import { CONSOLE_URL, WEBAPP_URL, WEBSITE_URL } from "@calcom/lib/constants";
// It ensures that redirection URL safe where it is accepted through a query params or other means where user can change it.
export const getSafeRedirectUrl = (url: string = "") => {
export const getSafeRedirectUrl = (url = "") => {
if (!url) {
return null;
}
if (url.search(/^https?:\/\//) === -1) {
throw new Error("Pass an absolute URL");
}