@@ -164,19 +163,17 @@
-
- {/if}
-
- {#if step === AuthStep.SSO}
-
+
{/if}
{#if step === AuthStep.Login || step === AuthStep.SignUp}
{
- if (signupErr) {
- handleAuthError(signupErr);
+ (loginErr) => {
+ if (loginErr) {
+ displayError({ message: loginErr?.description });
+ showForgetPassword = true;
} else {
disabled = false;
}
},
);
} else {
- webAuth.login(
+ console.log("attempt to sign up and login");
+ // Attempt to sign up and login the user
+ webAuth.redirect.signupAndLogin(
{
- realm: DATABASE_CONNECTION,
- username: email,
+ connection: DATABASE_CONNECTION,
+ email: email,
password: password,
},
(err) => {
if (err) {
- displayError({ message: err?.description });
+ console.log("err", err);
+ // Check if the error is about user already existing
+ if (err.description && err.description.includes("User exists.")) {
+ // If user exists, try logging them in
+ console.log("user exists, trying to login");
+ webAuth.login(
+ {
+ realm: DATABASE_CONNECTION,
+ username: email,
+ password: password,
+ },
+ (loginErr) => {
+ if (loginErr) {
+ displayError({ message: loginErr?.description });
+ showForgetPassword = true;
+ } else {
+ disabled = false;
+ }
+ },
+ );
+ } else {
+ handleAuthError(err);
+ showForgetPassword = true;
+ }
} else {
disabled = false;
}
@@ -131,6 +155,7 @@
}
} catch (err) {
handleAuthError(err);
+ showForgetPassword = true;
}
}
diff --git a/web-auth/src/components/EmailSubmissionForm.svelte b/web-auth/src/components/EmailSubmissionForm.svelte
index 9b2f2608bfe..abab37040c5 100644
--- a/web-auth/src/components/EmailSubmissionForm.svelte
+++ b/web-auth/src/components/EmailSubmissionForm.svelte
@@ -1,9 +1,13 @@
-
-
-
-
- Continue with SAML SSO
-
-
-
{
- dispatch("back");
- }}
- >
-
-
-
-
-{#if errorText}
- {errorText}
-{/if}
diff --git a/web-common/src/components/calls-to-action/CTANeedHelp.svelte b/web-common/src/components/calls-to-action/CTANeedHelp.svelte
index 91574c9e6b7..5ae505b6ae4 100644
--- a/web-common/src/components/calls-to-action/CTANeedHelp.svelte
+++ b/web-common/src/components/calls-to-action/CTANeedHelp.svelte
@@ -1,5 +1,5 @@
- Need help? Reach out to us on Discordsupport@rilldata.com