Skip to content

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

rate limit email sending

ammarahm-edf0efe6bc89f3
diff --git a/apps/mobile/src/components/LoginDialog/index.js b/apps/mobile/src/components/LoginDialog/index.js
index 9eb33976d..67dce98c7 100644
--- a/apps/mobile/src/components/LoginDialog/index.js
+++ b/apps/mobile/src/components/LoginDialog/index.js
@@ -274,6 +274,14 @@ const LoginDialog = () => {
return;
}
try {
+ let lastRecoveryEmailTime = await MMKV.getItem('lastRecoveryEmailTime');
+ if (
+ lastRecoveryEmailTime &&
+ Date.now() - JSON.parse(lastRecoveryEmailTime) < 60000 * 10
+ ) {
+ throw new Error('Please wait before requesting another email');
+ }
+ await MMKV.setItem('lastRecoveryEmailTime', JSON.stringify(Date.now()));
await db.user.recoverAccount(email);
} catch (e) {
ToastEvent.show(e.message, 'error', 'local');