Skip to content

Commit

Permalink
prevent signin clickjacking
Browse files Browse the repository at this point in the history
  • Loading branch information
AykutSarac committed Oct 7, 2023
1 parent 6b81875 commit 9af53e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
13 changes: 0 additions & 13 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ const config = {
compiler: {
styledComponents: true,
},
async headers() {
return [
{
source: "/sign-in",
headers: [
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
],
},
];
},
};

const bundleAnalyzerConfig = withBundleAnalyzer(config);
Expand Down
6 changes: 3 additions & 3 deletions src/pages/sign-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { toast } from "react-hot-toast";
import { AiOutlineGithub, AiOutlineGoogle } from "react-icons/ai";
import Layout from "src/layout/Layout";
import { supabase } from "src/lib/api/supabase";
import { isIframe } from "src/lib/utils/widget";
import useUser from "src/store/useUser";

export function AuthenticationForm(props: PaperProps) {
Expand Down Expand Up @@ -185,9 +186,8 @@ const SignIn = () => {
const isPasswordReset = query?.type === "recovery" && !query?.error;

React.useEffect(() => {
if (isReady && session && !isPasswordReset) {
push("/editor");
}
if (isIframe()) push("/");
if (isReady && session && !isPasswordReset) push("/editor");
}, [isReady, session, push, isPasswordReset]);

return (
Expand Down

0 comments on commit 9af53e5

Please sign in to comment.