@@ -26,10 +26,10 @@ export const authOptions: NextAuthOptions = {
2626 return false ;
2727 }
2828 //extract dep and year from email
29- const dep = profile . email . split ( '@' ) [ 1 ] . split ( '.' ) [ 0 ] ;
30- const match = profile . email . match ( / _ ? b ( \d + ) @ / ) ;
29+ const dep = profile . email . split ( '@' ) [ 1 ] . split ( '.' ) [ 0 ] ;
30+ const match = profile . email . match ( / _ ? b ( \d + ) @ / ) ;
3131 const year = match ? parseInt ( match [ 1 ] , 10 ) + 2000 : null ;
32-
32+
3333 // console.log(`Extracted department: ${dep}, year: ${year} from email: ${profile.email}`);
3434 // Sync user to Supabase
3535 try {
@@ -48,7 +48,7 @@ export const authOptions: NextAuthOptions = {
4848 name : profile . name || user . name ,
4949 picture : profile . image || user . image ,
5050 branch :dep ,
51- year : year ,
51+ year : year ,
5252 is_admin : 0 , // Explicitly set to 0, can only be changed via Supabase
5353 } ] ) ;
5454 } else {
@@ -59,7 +59,7 @@ export const authOptions: NextAuthOptions = {
5959 name : profile . name || user . name ,
6060 picture : profile . image || user . image ,
6161 branch :dep ,
62- year : year ,
62+ year : year ,
6363 } )
6464 . eq ( 'email' , profile . email ) ;
6565 }
@@ -104,7 +104,7 @@ export const authOptions: NextAuthOptions = {
104104 if ( url . includes ( '/api/auth/callback' ) ) {
105105 return baseUrl + "/dashboard" ;
106106 }
107-
107+
108108 // Handle other redirects
109109 if ( url . startsWith ( baseUrl ) ) return url ;
110110 else if ( url . startsWith ( "/" ) ) return new URL ( url , baseUrl ) . toString ( ) ;
0 commit comments