This commit is contained in:
Benjamin Toby 2024-12-10 15:31:53 +01:00
parent 12a07a4348
commit 5eef6628a4
3 changed files with 8 additions and 9 deletions

View File

@ -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": {

View File

@ -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");

View File

@ -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;
}
}