diff --git a/web/src/components/PasswordSignInForm.tsx b/web/src/components/PasswordSignInForm.tsx index 94d5318e97708..7cc311762d6ec 100644 --- a/web/src/components/PasswordSignInForm.tsx +++ b/web/src/components/PasswordSignInForm.tsx @@ -55,7 +55,7 @@ const PasswordSignInForm = () => { actionBtnLoadingState.setLoading(); await authServiceClient.signIn({ username, password, neverExpire: remember }); await userStore.fetchCurrentUser(); - await userStore.updateUserSetting({ lastLoginTime: Date.parse(new Date().toISOString()) },["lastLoginTime"]); + await userStore.updateUserSetting({ lastLoginTime: Date.parse(new Date().toISOString()) }, ["lastLoginTime"]); navigateTo("/"); } catch (error: any) { console.error(error); diff --git a/web/src/pages/AuthCallback.tsx b/web/src/pages/AuthCallback.tsx index 9f4d187e8f494..a105eeb3a58e6 100644 --- a/web/src/pages/AuthCallback.tsx +++ b/web/src/pages/AuthCallback.tsx @@ -57,19 +57,24 @@ const AuthCallback = () => { }); const user = await userStore.fetchCurrentUser(); const currentDate = new Date(); - + const currentDateString = Date.parse(currentDate.toISOString()); - if (user.sessionTimeout && user.lastLoginTime && new Date(user.lastLoginTime).getTime() + (user.sessionTimeout * 1000) < currentDateString) { + if ( + user.sessionTimeout && + user.lastLoginTime && + new Date(user.lastLoginTime).getTime() + user.sessionTimeout * 1000 < currentDateString + ) { authServiceClient.signOut({}); navigateTo("/auth/sign-in"); - } - else{ - await userStore.updateUserSetting({ - lastLoginTime: currentDateString, - }, ["lastLoginTime"]); + } else { + await userStore.updateUserSetting( + { + lastLoginTime: currentDateString, + }, + ["lastLoginTime"], + ); } - navigateTo("/"); } catch (error: any) { console.error(error);