File tree Expand file tree Collapse file tree 9 files changed +92
-28
lines changed Expand file tree Collapse file tree 9 files changed +92
-28
lines changed Original file line number Diff line number Diff line change 1
1
import Page from "./page" ;
2
- export const metadata = {
3
- title : "Reset Password - Open PRO" ,
4
- description : "Page description" ,
5
- } ;
2
+ import { constructMetadata } from "@/lib/utils"
3
+ import { Metadata } from "next/types"
4
+
5
+ export const metadata : Metadata = constructMetadata ( {
6
+ title : 'Reset Password' ,
7
+ description : 'Reset your password' ,
8
+ canonical : '/reset-password' ,
9
+ } )
6
10
7
11
export default Page ;
Original file line number Diff line number Diff line change 1
1
import Page from "./page" ;
2
- export const metadata = {
3
- title : "Sign In - Open PRO" ,
4
- description : "Page description" ,
5
- } ;
2
+ import { constructMetadata } from "@/lib/utils"
3
+ import { Metadata } from "next/types"
4
+
5
+ export const metadata : Metadata = constructMetadata ( {
6
+ title : 'Sign In' ,
7
+ description : 'Sign in to your account' ,
8
+ canonical : '/signin' ,
9
+ } )
6
10
7
11
export default Page ;
Original file line number Diff line number Diff line change @@ -6,11 +6,6 @@ export default async function SignIn() {
6
6
const supabase = createClient ( ) ;
7
7
const { data } = await supabase . auth . getUser ( ) ;
8
8
9
- if ( process . env . NODE_ENV === "production" ) {
10
- // Temporarily redirect to home page in production until we have a proper backend auth flow
11
- redirect ( "/" ) ;
12
- }
13
-
14
9
if ( data ?. user ) {
15
10
redirect ( "/" ) ;
16
11
}
Original file line number Diff line number Diff line change 1
1
import Page from "./page" ;
2
- export const metadata = {
3
- title : "Sign Up - Open PRO" ,
4
- description : "Page description" ,
5
- } ;
2
+ import { constructMetadata } from "@/lib/utils"
3
+ import { Metadata } from "next/types"
4
+
5
+ export const metadata : Metadata = constructMetadata ( {
6
+ title : 'Sign Up' ,
7
+ description : 'Sign up for an account' ,
8
+ canonical : '/signup' ,
9
+ } )
6
10
7
11
export default Page ;
Original file line number Diff line number Diff line change @@ -3,14 +3,9 @@ import { createClient } from "@/utils/supabase/server";
3
3
import SignUpComponent from "@/components/auth/signup" ;
4
4
5
5
export default async function SignUp ( ) {
6
- const supabase = createClient ( ) ;
7
- const { data } = await supabase . auth . getUser ( ) ;
8
-
9
- if ( process . env . NODE_ENV === "production" ) {
10
- // Temporarily redirect to home page in production until we have a proper backend auth flow
11
- redirect ( "/" ) ;
12
- }
13
-
6
+ const supabase = createClient ( )
7
+ const { data } = await supabase . auth . getUser ( )
8
+
14
9
if ( data ?. user ) {
15
10
redirect ( "/" ) ;
16
11
}
Original file line number Diff line number Diff line change
1
+ import Page from "./page" ;
2
+ import { constructMetadata } from "@/lib/utils"
3
+ import { Metadata } from "next/types"
4
+
5
+ export const metadata : Metadata = constructMetadata ( {
6
+ title : 'Settings' ,
7
+ description : 'Settings for your account.' ,
8
+ canonical : '/settings' ,
9
+ } )
10
+
11
+ export default Page ;
Original file line number Diff line number Diff line change
1
+ import { redirect } from 'next/navigation'
2
+ import { createClient } from '@/utils/supabase/server'
3
+
4
+ export default async function Settings ( ) {
5
+ const supabase = createClient ( )
6
+
7
+ const { data, error } = await supabase . auth . getUser ( )
8
+ if ( error || ! data ?. user ) {
9
+ redirect ( '/signin' )
10
+ }
11
+
12
+ return (
13
+ < section className = "relative" >
14
+ < div className = "max-w-6xl mx-auto px-4 sm:px-6" >
15
+ < div className = "pt-32 pb-12 md:pt-40 md:pb-20" >
16
+
17
+ { /* Page header */ }
18
+ < div className = "max-w-3xl mx-auto text-center pb-12 md:pb-20" >
19
+ < h1 className = "h1" > Settings</ h1 >
20
+ </ div >
21
+
22
+ { /* Settings */ }
23
+ < div className = "max-w-sm mx-auto" >
24
+ < div className = "flex flex-wrap -mx-3 mb-4" >
25
+ < div className = "w-full px-3" >
26
+ < p className = "text-gray-300 text-sm font-medium mb-1" >
27
+ Full Name: { data . user . user_metadata . full_name }
28
+ </ p >
29
+ < p className = "text-gray-300 text-sm font-medium mb-1" >
30
+ Email: { data . user . email }
31
+ </ p >
32
+ </ div >
33
+ </ div >
34
+ </ div >
35
+ </ div >
36
+ </ div >
37
+ </ section >
38
+ )
39
+ }
Original file line number Diff line number Diff line change @@ -31,11 +31,21 @@ export default async function AuthButton() {
31
31
</ Link >
32
32
</ >
33
33
) : (
34
+ < >
35
+ < Link
36
+ href = "/settings"
37
+ className = "font-medium inline-flex items-center justify-center border border-transparent px-4 py-2 my-2 mx-4 rounded-sm text-white bg-purple-600 hover:bg-purple-700 transition duration-150 ease-in-out"
38
+ >
39
+ Settings
40
+ </ Link >
34
41
< form action = { handleSignOut } >
35
- < button className = "my-2 ml-4 inline-flex items-center justify-center rounded-sm border border-transparent bg-purple-600 px-4 py-2 font-medium text-white transition duration-150 ease-in-out hover:bg-purple-700" >
42
+ < button
43
+ className = "font-medium inline-flex items-center justify-center border border-transparent px-4 py-2 my-2 rounded-sm text-white bg-gray-700 hover:bg-gray-800 transition duration-150 ease-in-out"
44
+ >
36
45
Sign out
37
46
</ button >
38
47
</ form >
48
+ </ >
39
49
) }
40
50
</ div >
41
51
) ;
Original file line number Diff line number Diff line change @@ -3,8 +3,10 @@ import { updateSession } from "./utils/supabase/middleware";
3
3
4
4
export async function middleware ( request : NextRequest ) {
5
5
if (
6
- request . nextUrl . pathname . startsWith ( "/signin" ) ||
7
- request . nextUrl . pathname . startsWith ( "/signup" )
6
+ ( request . nextUrl . pathname . startsWith ( "/signin" ) ||
7
+ request . nextUrl . pathname . startsWith ( "/signup" ) )
8
+ // FEATURE FLAG
9
+ && process . env . NODE_ENV === "production"
8
10
) {
9
11
return NextResponse . redirect ( new URL ( "/" , request . url ) ) ;
10
12
}
You can’t perform that action at this time.
0 commit comments