fix: update auth routes
This commit is contained in:
@ -77,14 +77,21 @@ function LoginForm() {
|
|||||||
size="lg"
|
size="lg"
|
||||||
disabled={isAnyLoading}
|
disabled={isAnyLoading}
|
||||||
>
|
>
|
||||||
{isGoogleLoading ? <Loader2 className="animate-spin" /> : (<GoogleIcon />)} Continue with Google
|
{isGoogleLoading ? (
|
||||||
|
<Loader2 className="animate-spin" />
|
||||||
|
) : (
|
||||||
|
<GoogleIcon />
|
||||||
|
)}{" "}
|
||||||
|
Continue with Google
|
||||||
</Button>
|
</Button>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div className="absolute inset-0 flex items-center">
|
<div className="absolute inset-0 flex items-center">
|
||||||
<Separator className="w-full" />
|
<Separator className="w-full" />
|
||||||
</div>
|
</div>
|
||||||
<div className="relative flex justify-center text-xs uppercase">
|
<div className="relative flex justify-center text-xs uppercase">
|
||||||
<span className="bg-background px-2 text-muted-foreground">Or continue with</span>
|
<span className="bg-background px-2 text-muted-foreground">
|
||||||
|
Or continue with
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
@ -144,14 +151,21 @@ export default function LoginPage() {
|
|||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="pt-0">
|
<CardContent className="pt-0">
|
||||||
<Suspense fallback={<div className="text-center">
|
<Suspense
|
||||||
<Loader2 className="animate-spin" />
|
fallback={
|
||||||
</div>}>
|
<div className="text-center">
|
||||||
|
<Loader2 className="animate-spin" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
<LoginForm />
|
<LoginForm />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
<div className="mt-6 text-center text-sm">
|
<div className="mt-6 text-center text-sm">
|
||||||
Don't have an account?{" "}
|
Don't have an account?{" "}
|
||||||
<Link href="/auth/signup" className="font-medium text-primary underline-offset-4 hover:underline">
|
<Link
|
||||||
|
href="/signup"
|
||||||
|
className="font-medium text-primary underline-offset-4 hover:underline"
|
||||||
|
>
|
||||||
Sign up
|
Sign up
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,7 +44,7 @@ function SignUpForm() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
router.push("/auth/login");
|
router.push("/login");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGoogleSignUp = async () => {
|
const handleGoogleSignUp = async () => {
|
||||||
@ -80,7 +80,12 @@ function SignUpForm() {
|
|||||||
size="lg"
|
size="lg"
|
||||||
disabled={isAnyLoading}
|
disabled={isAnyLoading}
|
||||||
>
|
>
|
||||||
{isGoogleLoading ? <Loader2 className="animate-spin" /> : (<GoogleIcon />)} Continue with Google
|
{isGoogleLoading ? (
|
||||||
|
<Loader2 className="animate-spin" />
|
||||||
|
) : (
|
||||||
|
<GoogleIcon />
|
||||||
|
)}{" "}
|
||||||
|
Continue with Google
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
@ -88,7 +93,9 @@ function SignUpForm() {
|
|||||||
<Separator className="w-full" />
|
<Separator className="w-full" />
|
||||||
</div>
|
</div>
|
||||||
<div className="relative flex justify-center text-xs uppercase">
|
<div className="relative flex justify-center text-xs uppercase">
|
||||||
<span className="bg-background px-2 text-muted-foreground">Or continue with</span>
|
<span className="bg-background px-2 text-muted-foreground">
|
||||||
|
Or continue with
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -135,7 +142,11 @@ function SignUpForm() {
|
|||||||
className="w-full h-11"
|
className="w-full h-11"
|
||||||
size="lg"
|
size="lg"
|
||||||
>
|
>
|
||||||
{isEmailLoading ? <Loader2 className="animate-spin" /> : "Create account"}
|
{isEmailLoading ? (
|
||||||
|
<Loader2 className="animate-spin" />
|
||||||
|
) : (
|
||||||
|
"Create account"
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -157,20 +168,29 @@ export default function SignUpPage() {
|
|||||||
|
|
||||||
<Card className="w-[400px] shadow-lg border-0">
|
<Card className="w-[400px] shadow-lg border-0">
|
||||||
<CardHeader className="text-center pb-4">
|
<CardHeader className="text-center pb-4">
|
||||||
<CardTitle className="text-2xl font-semibold">Create your account</CardTitle>
|
<CardTitle className="text-2xl font-semibold">
|
||||||
|
Create your account
|
||||||
|
</CardTitle>
|
||||||
<CardDescription className="text-base">
|
<CardDescription className="text-base">
|
||||||
Get started with your free account today
|
Get started with your free account today
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="pt-0">
|
<CardContent className="pt-0">
|
||||||
<Suspense fallback={<div className="text-center">
|
<Suspense
|
||||||
<Loader2 className="animate-spin" />
|
fallback={
|
||||||
</div>}>
|
<div className="text-center">
|
||||||
|
<Loader2 className="animate-spin" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
<SignUpForm />
|
<SignUpForm />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
<div className="mt-6 text-center text-sm">
|
<div className="mt-6 text-center text-sm">
|
||||||
Already have an account?{" "}
|
Already have an account?{" "}
|
||||||
<Link href="/auth/login" className="font-medium text-primary underline-offset-4 hover:underline">
|
<Link
|
||||||
|
href="/login"
|
||||||
|
className="font-medium text-primary underline-offset-4 hover:underline"
|
||||||
|
>
|
||||||
Sign in
|
Sign in
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,7 +23,7 @@ export function Header() {
|
|||||||
GitHub
|
GitHub
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href={session ? "/editor" : "/auth/login"}>
|
<Link href={session ? "/editor" : "/login"}>
|
||||||
<Button size="sm" className="text-sm ml-4">
|
<Button size="sm" className="text-sm ml-4">
|
||||||
Start editing
|
Start editing
|
||||||
<ArrowRight className="h-4 w-4" />
|
<ArrowRight className="h-4 w-4" />
|
||||||
|
@ -7,7 +7,7 @@ export async function middleware(request: NextRequest) {
|
|||||||
const session = getSessionCookie(request);
|
const session = getSessionCookie(request);
|
||||||
|
|
||||||
if (path === "/editor" && !session && process.env.NODE_ENV === "production") {
|
if (path === "/editor" && !session && process.env.NODE_ENV === "production") {
|
||||||
const loginUrl = new URL("/auth/login", request.url);
|
const loginUrl = new URL("/login", request.url);
|
||||||
loginUrl.searchParams.set("redirect", request.url);
|
loginUrl.searchParams.set("redirect", request.url);
|
||||||
return NextResponse.redirect(loginUrl);
|
return NextResponse.redirect(loginUrl);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user