diff --git a/src/app/(auth-pages)/layout.tsx b/src/app/(auth-pages)/layout.tsx
index ea6d1a2..a4dfbc4 100644
--- a/src/app/(auth-pages)/layout.tsx
+++ b/src/app/(auth-pages)/layout.tsx
@@ -1,6 +1,8 @@
const Layout = async ({ children }: { children: React.ReactNode }) => {
return (
-
{children}
+
+ {children}
+
);
};
export default Layout;
diff --git a/src/app/(auth-pages)/sign-up/page.tsx b/src/app/(auth-pages)/sign-up/page.tsx
index e96ec2e..be4c1db 100644
--- a/src/app/(auth-pages)/sign-up/page.tsx
+++ b/src/app/(auth-pages)/sign-up/page.tsx
@@ -2,7 +2,6 @@ import Link from 'next/link';
import { signUp } from '@/lib/actions';
import { FormMessage, type Message, SubmitButton } from '@/components/default';
import { Input, Label } from '@/components/ui';
-import { SmtpMessage } from '@/app/(auth-pages)/smtp-message';
const SignUp = async (props: { searchParams: Promise }) => {
const searchParams = await props.searchParams;
@@ -17,37 +16,33 @@ const SignUp = async (props: { searchParams: Promise }) => {
);
} else {
return (
- <>
-
-
- >
+
);
}
};
diff --git a/src/lib/actions/auth.ts b/src/lib/actions/auth.ts
index da7bc8f..79a7dae 100644
--- a/src/lib/actions/auth.ts
+++ b/src/lib/actions/auth.ts
@@ -7,6 +7,7 @@ import { headers } from 'next/headers';
import { redirect } from 'next/navigation';
export const signUp = async (formData: FormData) => {
+ const name = formData.get('name') as string;
const email = formData.get('email') as string;
const password = formData.get('password') as string;
const supabase = await createServerClient();
@@ -20,27 +21,37 @@ export const signUp = async (formData: FormData) => {
);
}
- const { error } = await supabase.auth.signUp({
+ const { data, error } = await supabase.auth.signUp({
email,
password,
- options: {
- emailRedirectTo: `${origin}/auth/callback`,
- },
+ //options: {
+ //emailRedirectTo: `${origin}/auth/callback`,
+ //},
});
if (error) {
console.error(error.code + ': ' + error.message);
- return encodedRedirect(
- 'error',
- '/sign-up',
- 'Thanks for signing up! Please check your email for a verification link.',
- );
+ return redirect('/protected');
+ //return encodedRedirect('error', '/sign-up',
+ //'Thanks for signing up! Please check your email for a verification link.');
} else {
- return encodedRedirect(
- 'success',
- '/sign-up',
- 'Thanks for signing up! Please check your email for a verification link.',
- );
+ try {
+ if (!data.user) throw new Error('Could not sign up');
+ const { error } = await supabase
+ .from('profiles')
+ .update({
+ full_name: name,
+ provider: 'email',
+ })
+ .eq('id', data.user.id);
+ if (error) throw new Error('Could not update profile');
+ } catch (error) {
+ console.error('Error updating profile: ', error);
+ } finally {
+ return redirect('/protected');
+ //return encodedRedirect('success', '/protected',
+ //'Thanks for signing up! Please check your email for a verification link.);
+ }
}
};