Updates
This commit is contained in:
parent
12a07a4348
commit
5eef6628a4
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/datasquirel",
|
||||
"version": "2.8.5",
|
||||
"version": "2.8.6",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
4
users/validate-temp-email-code.d.ts
vendored
4
users/validate-temp-email-code.d.ts
vendored
@ -8,12 +8,12 @@ export = validateTempEmailCode;
|
||||
* @param {http.IncomingMessage & Object<string, any>} params.request
|
||||
* @param {string} [params.email]
|
||||
*
|
||||
* @returns { Promise<boolean>}
|
||||
* @returns { Promise<import("../package-shared/types").SendOneTimeCodeEmailResponse | null>}
|
||||
*/
|
||||
declare function validateTempEmailCode({ request, email }: {
|
||||
request: http.IncomingMessage & {
|
||||
[x: string]: any;
|
||||
};
|
||||
email?: string;
|
||||
}): Promise<boolean>;
|
||||
}): Promise<import("../package-shared/types").SendOneTimeCodeEmailResponse | null>;
|
||||
import http = require("http");
|
||||
|
@ -15,7 +15,7 @@ const EJSON = require("../package-shared/utils/ejson");
|
||||
* @param {http.IncomingMessage & Object<string, any>} params.request
|
||||
* @param {string} [params.email]
|
||||
*
|
||||
* @returns { Promise<boolean>}
|
||||
* @returns { Promise<import("../package-shared/types").SendOneTimeCodeEmailResponse | null>}
|
||||
*/
|
||||
async function validateTempEmailCode({ request, email }) {
|
||||
try {
|
||||
@ -35,18 +35,17 @@ async function validateTempEmailCode({ request, email }) {
|
||||
);
|
||||
|
||||
if (payload?.email && !email) {
|
||||
return true;
|
||||
return payload;
|
||||
}
|
||||
|
||||
if (payload?.email && payload.email === email) {
|
||||
return true;
|
||||
return payload;
|
||||
}
|
||||
|
||||
return false;
|
||||
return null;
|
||||
} catch (/** @type {any} */ error) {
|
||||
console.log("validateTempEmailCode error:", error.message);
|
||||
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user