-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into zacharyb/eng-186
- Loading branch information
Showing
24 changed files
with
7,845 additions
and
115 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
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,98 @@ | ||
"use client"; | ||
|
||
import { useRouter } from "next/navigation"; | ||
import { z } from "zod"; | ||
|
||
import { | ||
Form, | ||
FormControl, | ||
FormField, | ||
FormItem, | ||
FormLabel, | ||
FormMessage, | ||
useForm, | ||
} from "@ctrlplane/ui/form"; | ||
import { Input } from "@ctrlplane/ui/input"; | ||
|
||
import { api } from "~/trpc/react"; | ||
|
||
const schema = z.object({ | ||
name: z.string().min(1), | ||
email: z.string().email(), | ||
password: z.string().min(8), | ||
}); | ||
|
||
export const SignUpCard: React.FC = () => { | ||
const router = useRouter(); | ||
const signUp = api.user.auth.signUp.useMutation(); | ||
const form = useForm({ | ||
schema, | ||
defaultValues: { | ||
name: "", | ||
email: "", | ||
password: "", | ||
}, | ||
}); | ||
|
||
const onSubmit = form.handleSubmit((data) => { | ||
signUp.mutate(data); | ||
router.replace("/login"); | ||
}); | ||
|
||
return ( | ||
<div className="container mx-auto mt-[150px] max-w-[375px]"> | ||
<h1 className="mb-10 text-center text-3xl font-bold"> | ||
Sign up for Ctrlplane | ||
</h1> | ||
<div className="space-y-6"> | ||
<div className="space-y-2"> | ||
<Form {...form}> | ||
<form onSubmit={onSubmit}> | ||
<FormField | ||
control={form.control} | ||
name="name" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Name</FormLabel> | ||
<FormControl> | ||
<Input {...field} /> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
|
||
<FormField | ||
control={form.control} | ||
name="email" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Email</FormLabel> | ||
<FormControl> | ||
<Input {...field} /> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
|
||
<FormField | ||
control={form.control} | ||
name="password" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Password</FormLabel> | ||
<FormControl> | ||
<Input {...field} type="password" /> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
</form> | ||
</Form> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
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,31 @@ | ||
import type { Metadata } from "next"; | ||
import { redirect } from "next/navigation"; | ||
import { IconPlane } from "@tabler/icons-react"; | ||
|
||
import { auth, isCredentialsAuthEnabled } from "@ctrlplane/auth"; | ||
import { Button } from "@ctrlplane/ui/button"; | ||
|
||
import { SignUpCard } from "./SignUpCard"; | ||
|
||
export const metadata: Metadata = { title: "Ctrlplane Login" }; | ||
|
||
export default async function LoginPage() { | ||
if (!isCredentialsAuthEnabled) redirect("/login"); | ||
|
||
const session = await auth(); | ||
if (session != null) redirect("/"); | ||
|
||
return ( | ||
<div className="h-full"> | ||
<div className="flex items-center gap-2 p-4"> | ||
<IconPlane className="h-10 w-10" /> | ||
<div className="flex-grow" /> | ||
<Button variant="ghost" className="text-muted-foreground"> | ||
Contact | ||
</Button> | ||
<Button variant="outline">Sign up</Button> | ||
</div> | ||
<SignUpCard /> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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,39 @@ | ||
version: "3.8" | ||
|
||
services: | ||
database: | ||
container_name: ctrlplane-database | ||
image: postgres:16 | ||
restart: always | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
POSTGRES_DB: ctrlplane | ||
POSTGRES_USER: ctrlplane | ||
POSTGRES_PASSWORD: ctrlplane | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
|
||
redis: | ||
image: redis:latest | ||
container_name: ctrlplane-redis | ||
restart: always | ||
ports: | ||
- "6379:6379" | ||
volumes: | ||
- redis-data:/data | ||
|
||
redisinsight: | ||
image: redis/redisinsight:latest | ||
container_name: ctrlplane-redisinsight | ||
links: | ||
- redis | ||
ports: | ||
- "5540:5540" | ||
volumes: | ||
- redisinsight-data:/data | ||
|
||
volumes: | ||
db-data: | ||
redis-data: | ||
redisinsight-data: |
Oops, something went wrong.