mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
fix: prevent SSR mismatch in OAuth URL generation (#7288)
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import { AuthForm } from "@/components/auth/oss";
|
||||
import { isGithubOAuthEnabled, isGoogleOAuthEnabled } from "@/lib/helper";
|
||||
import {
|
||||
getAuthUrl,
|
||||
isGithubOAuthEnabled,
|
||||
isGoogleOAuthEnabled,
|
||||
} from "@/lib/helper";
|
||||
|
||||
const SignIn = () => {
|
||||
const GOOGLE_AUTH_URL = getAuthUrl("google");
|
||||
const GITHUB_AUTH_URL = getAuthUrl("github");
|
||||
return (
|
||||
<AuthForm
|
||||
type="sign-in"
|
||||
googleAuthUrl={GOOGLE_AUTH_URL}
|
||||
githubAuthUrl={GITHUB_AUTH_URL}
|
||||
isGoogleOAuthEnabled={isGoogleOAuthEnabled}
|
||||
isGithubOAuthEnabled={isGithubOAuthEnabled}
|
||||
/>
|
||||
|
||||
@@ -18,19 +18,22 @@ import {
|
||||
FormField,
|
||||
FormMessage,
|
||||
} from "@/components/ui/form";
|
||||
import { getAuthUrl } from "@/lib/helper";
|
||||
import { ApiError, authFormSchema } from "@/types";
|
||||
|
||||
export const AuthForm = ({
|
||||
type,
|
||||
invitationToken,
|
||||
isCloudEnv,
|
||||
googleAuthUrl,
|
||||
githubAuthUrl,
|
||||
isGoogleOAuthEnabled,
|
||||
isGithubOAuthEnabled,
|
||||
}: {
|
||||
type: string;
|
||||
invitationToken?: string | null;
|
||||
isCloudEnv?: boolean;
|
||||
googleAuthUrl?: string;
|
||||
githubAuthUrl?: string;
|
||||
isGoogleOAuthEnabled?: boolean;
|
||||
isGithubOAuthEnabled?: boolean;
|
||||
}) => {
|
||||
@@ -326,7 +329,7 @@ export const AuthForm = ({
|
||||
variant="bordered"
|
||||
className="w-full"
|
||||
as="a"
|
||||
href={getAuthUrl("google")}
|
||||
href={googleAuthUrl}
|
||||
isDisabled={!isGoogleOAuthEnabled}
|
||||
>
|
||||
Continue with Google
|
||||
@@ -364,7 +367,7 @@ export const AuthForm = ({
|
||||
variant="bordered"
|
||||
className="w-full"
|
||||
as="a"
|
||||
href={getAuthUrl("github")}
|
||||
href={githubAuthUrl}
|
||||
isDisabled={!isGithubOAuthEnabled}
|
||||
>
|
||||
Continue with Github
|
||||
|
||||
Reference in New Issue
Block a user