Skip to content

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

mobile: fix relogin in session expired mode

Ammar Ahmedd412679fd74e
diff --git a/apps/mobile/app/components/auth/auth-modal.js b/apps/mobile/app/components/auth/auth-modal.js
index a49f1a615..2f42ddca7 100644
--- a/apps/mobile/app/components/auth/auth-modal.js
+++ b/apps/mobile/app/components/auth/auth-modal.js
@@ -91,6 +91,7 @@ const AuthModal = () => {
style={{
width: "100%"
}}
+ enableAutomaticScroll={false}
keyboardShouldPersistTaps="handled"
>
{currentAuthMode !== AuthMode.login ? (
diff --git a/apps/mobile/app/components/auth/session-expired.js b/apps/mobile/app/components/auth/session-expired.js
index 6966f8933..b99edd99a 100644
--- a/apps/mobile/app/components/auth/session-expired.js
+++ b/apps/mobile/app/components/auth/session-expired.js
@@ -69,7 +69,8 @@ export const SessionExpired = () => {
eSendEvent(eUserLoggedIn, true);
setVisible(false);
setFocused(false);
- }
+ },
+ true
);
const logout = async () => {
diff --git a/apps/mobile/app/components/auth/use-login.js b/apps/mobile/app/components/auth/use-login.js
index dbd392a29..4dbb900cc 100644
--- a/apps/mobile/app/components/auth/use-login.js
+++ b/apps/mobile/app/components/auth/use-login.js
@@ -33,7 +33,7 @@ export const LoginSteps = {
passwordAuth: 3
};
-export const useLogin = (onFinishLogin) => {
+export const useLogin = (onFinishLogin, sessionExpired = false) => {
const [error, setError] = useState(false);
const [loading, setLoading] = useState(false);
const setUser = useUserStore((state) => state.setUser);
@@ -69,6 +69,7 @@ export const useLogin = (onFinishLogin) => {
switch (step) {
case LoginSteps.emailAuth: {
const mfaInfo = await db.user.authenticateEmail(email.current);
+ console.log("email auth", mfaInfo);
if (mfaInfo) {
TwoFactorVerification.present(async (mfa, callback) => {
try {
@@ -101,7 +102,12 @@ export const useLogin = (onFinishLogin) => {
break;
}
case LoginSteps.passwordAuth: {
- await db.user.authenticatePassword(email.current, password.current);
+ await db.user.authenticatePassword(
+ email.current,
+ password.current,
+ null,
+ sessionExpired
+ );
finishLogin();
break;
}