From bebe1dd7b4377d8112c21a642817ac0d4739cdda Mon Sep 17 00:00:00 2001
From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Date: Thu, 5 Sep 2024 23:19:24 +0530
Subject: [PATCH] chore: improved lastused login method (#16511)
---
apps/web/modules/auth/login-view.tsx | 6 ++----
packages/features/auth/SAMLLogin.tsx | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/apps/web/modules/auth/login-view.tsx b/apps/web/modules/auth/login-view.tsx
index 80f81741ab..2ea689b837 100644
--- a/apps/web/modules/auth/login-view.tsx
+++ b/apps/web/modules/auth/login-view.tsx
@@ -256,12 +256,10 @@ PageProps & WithNonceProps<{}>) {
CustomStartIcon={}
onClick={async (e) => {
e.preventDefault();
- const res = await signIn("google", {
+ setLastUsed("google");
+ await signIn("google", {
callbackUrl,
});
- if (res && !res.error) {
- setLastUsed("google");
- }
}}>
{t("signin_with_google")}
{lastUsed === "google" && }
diff --git a/packages/features/auth/SAMLLogin.tsx b/packages/features/auth/SAMLLogin.tsx
index b6d9ae5153..598d14719b 100644
--- a/packages/features/auth/SAMLLogin.tsx
+++ b/packages/features/auth/SAMLLogin.tsx
@@ -26,10 +26,8 @@ export function SAMLLogin({ samlTenantID, samlProductID, setErrorMessage }: Prop
const mutation = trpc.viewer.public.samlTenantProduct.useMutation({
onSuccess: async (data) => {
- const res = await signIn("saml", {}, { tenant: data.tenant, product: data.product });
- if (res && !res.error) {
- setLastUsed("saml");
- }
+ setLastUsed("saml");
+ await signIn("saml", {}, { tenant: data.tenant, product: data.product });
},
onError: (err) => {
setErrorMessage(t(err.message));