-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add middleware for pages that need a logged-in user
- Loading branch information
1 parent
d32d2ea
commit 0830e05
Showing
6 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
"use client"; | ||
|
||
import {useSignInModal} from "@/components/layout/sign-in-modal"; | ||
import { getServerSession } from "next-auth"; | ||
import {authOptions} from "@/app/api/auth/[...nextauth]/route"; | ||
import { Button } from "@/components/ui/button"; | ||
import {signIn} from "next-auth/react"; | ||
import {Github, Google } from "@/components/shared/icons"; | ||
import {useRouter} from "next/navigation"; | ||
|
||
export default async function SignIn() { | ||
// const { SignInModal, setShowSignInModal } = useSignInModal(); | ||
|
||
return ( | ||
<> | ||
{/*<SignInModal />*/} | ||
{/*/!*{Object.values(providers).map((provider) => (*!/*/} | ||
{/*/!* <div key={provider.name}>*!/*/} | ||
{/*/!* <button onClick={() => signIn(provider.id)}>*!/*/} | ||
{/*/!* Sign in with {provider.name}*!/*/} | ||
{/*/!* </button>*!/*/} | ||
{/*/!* </div>*!/*/} | ||
{/*/!*))}*!/*/} | ||
<div className={"flex flex-col gap-2 items-center justify-center h-fit"}> | ||
<h1 className={"text-3xl mb-2"}>Sign In</h1> | ||
<h3 className={"text-xl mb-2"}>The requested page requires you to sign in.</h3> | ||
<Button | ||
onClick={() => { | ||
signIn("google"); | ||
}} | ||
> | ||
<Google className="h-5 w-5"/> | ||
<p> Sign In with Google</p> | ||
|
||
</Button> | ||
<Button | ||
onClick={() => { | ||
signIn("github"); | ||
}} | ||
> | ||
<Github className="h-5 w-5"/> | ||
<p> Sign In with Github</p> | ||
|
||
</Button> | ||
</div> | ||
|
||
{/*<Dialog open={true}>*/} | ||
{/* <DialogContent>*/} | ||
{/* <DialogHeader>*/} | ||
{/* <DialogTitle>Sign In</DialogTitle>*/} | ||
{/* /!*<DialogDescription>*!/*/} | ||
{/* /!* This action cannot be undone. This will permanently delete your account*!/*/} | ||
{/* /!* and remove your data from our servers.*!/*/} | ||
{/* /!*</DialogDescription>*!/*/} | ||
{/* </DialogHeader>*/} | ||
{/* <Button*/} | ||
{/* onClick={() => {*/} | ||
{/* signIn("google");*/} | ||
{/* }}*/} | ||
{/* >*/} | ||
{/* <Google className="h-5 w-5"/>*/} | ||
{/* <p> Sign In with Google</p>*/} | ||
{/* </Button>*/} | ||
{/* <Button*/} | ||
{/* onClick={() => {*/} | ||
{/* signIn("github");*/} | ||
{/* }}*/} | ||
{/* >*/} | ||
{/* <Github className="h-5 w-5"/>*/} | ||
{/* <p> Sign In with Github</p>*/} | ||
{/* </Button>*/} | ||
{/* </DialogContent>*/} | ||
{/*</Dialog>*/} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export {default} from "next-auth/middleware" | ||
|
||
export const config = {matcher: ["/quiz/:id/evaluation", "/quiz/:id/learn", "/quiz/create"]} |