File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,7 +87,6 @@ const jwtLogin = new JwtStrategy(
8787const GOOGLE_CLIENT_ID = process . env . GOOGLE_CLIENT_ID as string ;
8888const GOOGLE_CLIENT_SECRET = process . env . GOOGLE_CLIENT_SECRET as string ;
8989
90-
9190const googleStrategy = new GoogleStrategy (
9291 {
9392 clientID : GOOGLE_CLIENT_ID ,
@@ -146,6 +145,7 @@ const googleStrategy = new GoogleStrategy(
146145 firstName : profile . name ?. familyName || "Non renseigné" ,
147146 lastName : profile . name ?. givenName || "Non renseigné" ,
148147 } ,
148+ timezone : stateData ?. timezone ,
149149 } ) ;
150150
151151 // Pass both user and state data to the callback
Original file line number Diff line number Diff line change @@ -120,15 +120,22 @@ async function loginWithGoogle(
120120) {
121121 try {
122122 const redirectUrl = ( req . query . redirectUrl || "" ) as string ;
123+ const timezone = ( req . query . timezone || "" ) as string ;
124+
125+ console . log ( timezone ) ;
123126
124127 const stateObject = {
125- data : { } as { redirectUrl ?: string } ,
128+ data : { } as { redirectUrl ?: string ; timezone ?: string } ,
126129 } ;
127130
128131 if ( [ "profile" ] . includes ( redirectUrl ) ) {
129132 stateObject . data . redirectUrl = redirectUrl ;
130133 }
131134
135+ if ( timezone ) {
136+ stateObject . data . timezone = timezone ;
137+ }
138+
132139 // Encode state as base64url (URL-safe)
133140 const stateJson = JSON . stringify ( stateObject ) ;
134141 const state = Buffer . from ( stateJson ) . toString ( "base64url" ) ;
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ const findOrCreateUser = async (userData: Partial<IUser>) => {
3333 password : null ,
3434 googleId : userData . googleId ,
3535 profile : userData . profile || { } ,
36+ timezone : userData . timezone ,
3637 isVerified : true ,
3738 } ) ;
3839
You can’t perform that action at this time.
0 commit comments