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

@@ -77,6 +77,24 @@ module.exports = function (module) {
return value;
};
module.mget = async function (keys) {
if (!keys || !Array.isArray(keys) || !keys.length) {
return [];
}
const data = await module.client.collection('objects').find(
{ _key: { $in: keys } },
{ projection: { _id: 0 } }
).toArray();
const map = {};
data.forEach((d) => {
map[d._key] = d.data;
});
return keys.map(k => (map.hasOwnProperty(k) ? map[k] : null));
};
module.set = async function (key, value) {
if (!key) {
return;

View File

@@ -119,6 +119,31 @@ SELECT s."data" t
return res.rows.length ? res.rows[0].t : null;
};
module.mget = async function (keys) {
if (!keys || !Array.isArray(keys) || !keys.length) {
return [];
}
const res = await module.pool.query({
name: 'mget',
text: `
SELECT s."data", s."_key"
FROM "legacy_object_live" o
INNER JOIN "legacy_string" s
ON o."_key" = s."_key"
AND o."type" = s."type"
WHERE o."_key" = ANY($1::TEXT[])
LIMIT 1`,
values: [keys],
});
const map = {};
res.rows.forEach((d) => {
map[d._key] = d.data;
});
return keys.map(k => (map.hasOwnProperty(k) ? map[k] : null));
};
module.set = async function (key, value) {
if (!key) {
return;

View File

@@ -60,6 +60,13 @@ module.exports = function (module) {
return await module.client.get(key);
};
module.mget = async function (keys) {
if (!keys || !Array.isArray(keys) || !keys.length) {
return [];
}
return await module.client.mget(keys);
};
module.set = async function (key, value) {
await module.client.set(key, value);
};