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