diff --git a/src/auth/operations/verifyEmail.js b/src/auth/operations/verifyEmail.js index 81fabee7e0..2d73a18593 100644 --- a/src/auth/operations/verifyEmail.js +++ b/src/auth/operations/verifyEmail.js @@ -10,15 +10,14 @@ async function verifyEmail(args) { // 2. Perform password reset // ///////////////////////////////////// - // TODO: How do we know which collection this is? const user = await args.collection.Model.findOne({ _verificationToken: args.token, }); if (!user) throw new APIError('User not found.', httpStatus.BAD_REQUEST); + if (user && user._verified === true) throw new APIError('Already activated', httpStatus.ACCEPTED); user._verified = true; - user._verificationToken = null; await user.save(); } diff --git a/src/client/components/views/Verify/index.js b/src/client/components/views/Verify/index.js index 1fd7079612..7b180bb8ec 100644 --- a/src/client/components/views/Verify/index.js +++ b/src/client/components/views/Verify/index.js @@ -34,6 +34,12 @@ const Verify = () => { return ; } + const getText = () => { + if (verifyResult?.status === 200) return 'Verified Successfully'; + if (verifyResult?.status === 202) return 'Already Activated'; + return 'Unable To Verify'; + }; + return ( {

- {verifyResult?.status === 200 ? 'Verified Successfully' : 'Unable To Verify'} + {getText()}

{isAdminUser && verifyResult?.status === 200 && (