Skip to content

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

add resend verification email function

ammarahm-ed3a849288032b
diff --git a/apps/mobile/src/components/ProgressDialog/index.js b/apps/mobile/src/components/ProgressDialog/index.js
index 482837a6c..78480cdfe 100644
--- a/apps/mobile/src/components/ProgressDialog/index.js
+++ b/apps/mobile/src/components/ProgressDialog/index.js
@@ -9,6 +9,7 @@ import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
import {Button} from '../Button';
import BaseDialog from '../Dialog/base-dialog';
import DialogContainer from '../Dialog/dialog-container';
+import { Toast } from '../Toast';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
@@ -76,9 +77,12 @@ const ProgressDialog = () => {
{dialogData?.action ? (
<Button
type="transparent"
+ onPress={dialogData.action}
title={dialogData.actionText}
/>
) : null}
+
+ <Toast context="local" />
</ActionSheetWrapper>
);
};
diff --git a/apps/mobile/src/services/Message.js b/apps/mobile/src/services/Message.js
index f65ced10d..a1a3a82c4 100644
--- a/apps/mobile/src/services/Message.js
+++ b/apps/mobile/src/services/Message.js
@@ -1,10 +1,12 @@
import {Actions} from '../provider/Actions';
+import {db} from '../utils/DB';
import {
eCloseProgressDialog,
eOpenLoginDialog,
eOpenProgressDialog,
} from '../utils/Events';
-import {eSendEvent} from './EventManager';
+import {MMKV} from '../utils/mmkv';
+import {eSendEvent, ToastEvent} from './EventManager';
export function setLoginMessage(dispatch) {
dispatch({
@@ -35,8 +37,24 @@ export function setEmailVerifyMessage(dispatch) {
title: 'Account not verified',
paragraph:
'We have sent you an account confirmation link. Please check your email to verify your account.',
- action: () => {
- eSendEvent(eCloseProgressDialog);
+ action: async () => {
+ let lastEmailTime = await MMKV.getItem('lastEmailTime');
+ if (
+ lastEmailTime &&
+ Date.now() - JSON.parse(lastEmailTime) < 60000 * 10
+ ) {
+ ToastEvent.show(
+ 'Please wait before sending another email.',
+ 'error',
+ 'local',
+ );
+ console.log("error")
+ return;
+ }
+ await db.user.sendVerificationEmail();
+ console.log("passed",lastEmailTime)
+ await MMKV.setItem('lastEmailTime', JSON.stringify(Date.now()));
+ ToastEvent.show('Verification email sent!', 'success', 'local');
},
actionText: 'Resend Confirmation Link',
noProgress: true,