Skip to content

Commit

Permalink
finish signup credential auth page
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Oct 12, 2024
1 parent f17458c commit 032992c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { IconPlane } from "@tabler/icons-react";
import { auth, isGoogleAuthEnabled, isOIDCAuthEnabled } from "@ctrlplane/auth";
import { Button } from "@ctrlplane/ui/button";

import { env } from "~/env";
import { LoginCard } from "../../LoginCard";

export default async function LoginInvitePage() {
Expand Down
5 changes: 1 addition & 4 deletions apps/webservice/src/app/(auth)/sign-up/SignUpCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ const schema = z.object({
password: z.string().min(8),
});

export const SignUpCard: React.FC<{
isGoogleEnabled: boolean;
isOidcEnabled: boolean;
}> = () => {
export const SignUpCard: React.FC = () => {
const router = useRouter();
const signUp = api.user.auth.signUp.useMutation();
const form = useForm({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
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";

export default function AuthPage({ children }: { children: React.ReactNode }) {
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">
Expand All @@ -13,7 +25,7 @@ export default function AuthPage({ children }: { children: React.ReactNode }) {
</Button>
<Button variant="outline">Sign up</Button>
</div>
{children}
<SignUpCard />
</div>
);
}

0 comments on commit 032992c

Please sign in to comment.