Fixes for "validate email" & "send validation email" in ACP (#11677)

* confirmObj changes

dont expire confirm:<code>, add a expires field instead
dont expire confirm:byUid:<uid>

on admin manage users display the users email status
	1. verified
	2. verify email sent (pending)
	3. verify email sent (expired)
	4. no email entered

fix validate email in acp to use
	email in user:<uid> if they have one
	if not check if its in confirm:<code>
	if its not in above cant validate throw error

fix send validate email to use
	email in user:<uid> if they have one
	if not check if its in confirm:<code>
	if its not in above too cant validate throw error

* add back socket.io tests

* test: fix confirm tests

no longer using pexpire
return correct time left on token

* chore: update openapi

* fix: delete call

* test: mget test fixes

* test: fix tests
This commit is contained in:
Barış Soner Uşaklı
2023-06-05 12:12:48 -04:00
committed by GitHub
parent 1e137b0705
commit 04998908ba
13 changed files with 144 additions and 25 deletions

View File

@@ -130,9 +130,9 @@ describe('email confirmation (library methods)', () => {
await user.email.sendValidationEmail(uid, {
email,
});
await db.pexpire(`confirm:byUid:${uid}`, 1000);
const code = await db.get(`confirm:byUid:${uid}`);
await db.setObjectField(`confirm:${code}`, 'expires', Date.now() + 1000);
const ok = await user.email.canSendValidation(uid, email);
assert(ok);
});
});