Updated login page, added ProtectedRoute object for wrapping in layouts, added ProtectedRoute authorization verification to Admin route root
This commit is contained in:
parent
f055e77eea
commit
efa42a53b2
5 changed files with 65 additions and 17 deletions
30
app/Authentication/Login/page.tsx
Normal file
30
app/Authentication/Login/page.tsx
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use client";
|
||||
import { useState } from "react";
|
||||
|
||||
import { login, signup } from "@/lib/server_functions/userAuth";
|
||||
import Form from "@/components/ui/Form";
|
||||
export default function Login() {
|
||||
const [createAccount, setCreateAccount] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="flex h-full w-full justify-center py-10">
|
||||
<Form
|
||||
action={createAccount ? login : signup}
|
||||
submitText={createAccount ? "Login" : "Signup"}
|
||||
>
|
||||
<input type="text" name="username" placeholder="Username" required />
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
placeholder="Password"
|
||||
required
|
||||
/>
|
||||
<button onClick={() => setCreateAccount(!createAccount)}>
|
||||
{createAccount
|
||||
? "Don't have an account?"
|
||||
: "Already have an account?"}
|
||||
</button>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue