Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: skip login init when doing quick login

thecodrr27cd6d6b3f28
diff --git a/apps/web/src/common/dialogcontroller.js b/apps/web/src/common/dialogcontroller.js
index c5f4948c6..649d064d3 100644
--- a/apps/web/src/common/dialogcontroller.js
+++ b/apps/web/src/common/dialogcontroller.js
@@ -341,12 +341,13 @@ export function showLoadingDialog(dialogData) {
));
}
-export const showLogInDialog = (title, description, positiveText) => {
+export const showLogInDialog = (title, description, positiveText, skipInit) => {
return showDialog((Dialogs, perform) => (
<Dialogs.LoginDialog
title={title}
description={description}
positiveText={positiveText}
+ skipInit={skipInit}
onClose={() => perform()}
/>
));
diff --git a/apps/web/src/components/dialogs/logindialog.js b/apps/web/src/components/dialogs/logindialog.js
index 842f4c222..df2d95e8d 100644
--- a/apps/web/src/components/dialogs/logindialog.js
+++ b/apps/web/src/components/dialogs/logindialog.js
@@ -10,7 +10,7 @@ import { hashNavigate } from "../../navigation";
const requiredValues = ["email", "password", "remember"];
function LoginDialog(props) {
- const { onClose, title, description, positiveText } = props;
+ const { onClose, title, description, positiveText, skipInit } = props;
const [error, setError] = useState();
const [credential, setCredential] = useState();
const [email, setEmail] = useState();
@@ -110,7 +110,6 @@ function LoginDialog(props) {
id="loginForm"
as="form"
onSubmit={(e) => {
- console.log("SUBMIT", e);
e.preventDefault();
const form = new FormData(e.target);
const data = requiredValues.reduce((prev, curr) => {
@@ -120,7 +119,7 @@ function LoginDialog(props) {
setError();
- login(data)
+ login(data, skipInit)
.then(async () => {
// Instantiate PasswordCredential with the form
if (window.PasswordCredential) {
diff --git a/apps/web/src/stores/user-store.js b/apps/web/src/stores/user-store.js
index c4661f2c8..e1ae68664 100644
--- a/apps/web/src/stores/user-store.js
+++ b/apps/web/src/stores/user-store.js
@@ -66,11 +66,12 @@ class UserStore extends BaseStore {
});
};
- login = (form) => {
+ login = (form, skipInit = false) => {
this.set((state) => (state.isLoggingIn = true));
return db.user
.login(form.email.toLowerCase(), form.password, form.remember)
.then(() => {
+ if (skipInit) return true;
return showLoadingDialog({
title: "Importing your data...",
subtitle:
diff --git a/apps/web/src/views/email-confirmed.js b/apps/web/src/views/email-confirmed.js
index b852008ce..47bd99c13 100644
--- a/apps/web/src/views/email-confirmed.js
+++ b/apps/web/src/views/email-confirmed.js
@@ -140,7 +140,8 @@ function SaleBanner(props) {
await showLogInDialog(
`Login in to get ${discount}% off`,
`Use the coupon "${coupon}" at checkout to get ${discount}% off your first month.`,
- `Get ${discount}% off`
+ `Get ${discount}% off`,
+ true
);
user = await db.user.getUser();
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index 660b2205a..7edea09c5 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -9223,7 +9223,7 @@ notes-core@../notes-core/:
"notes-core@git+https://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:[email protected]/streetwriters/notesnook-core.git":
version "6.6.4"
- resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#9f0527dad6b97bbce4739109e75594231148ae45"
+ resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#9eb15a9484763dbee9a3a7715374d266f974bda7"
dependencies:
fast-sort "^2.0.1"
fuzzysort "^1.1.4"