Updates
This commit is contained in:
parent
3cf76f5155
commit
3437be2c08
@ -21,7 +21,7 @@ const query_dsql_api_1 = __importDefault(require("../../functions/api/query-dsql
|
|||||||
*/
|
*/
|
||||||
function sendEmailCode(params) {
|
function sendEmailCode(params) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const { apiKey, email, database, temp_code_field_name, mail_domain, mail_password, mail_username, mail_port, sender, response, extraCookies, useLocal, apiVersion, dbUserId, html, } = params;
|
const { apiKey, email, database, temp_code_field_name, mail_domain, mail_password, mail_username, mail_port, sender, response, extraCookies, useLocal, apiVersion, html, } = params;
|
||||||
const defaultTempLoginFieldName = "temp_login_code";
|
const defaultTempLoginFieldName = "temp_login_code";
|
||||||
const emailLoginTempCodeFieldName = temp_code_field_name
|
const emailLoginTempCodeFieldName = temp_code_field_name
|
||||||
? temp_code_field_name
|
? temp_code_field_name
|
||||||
@ -40,7 +40,6 @@ function sendEmailCode(params) {
|
|||||||
sender,
|
sender,
|
||||||
response,
|
response,
|
||||||
extraCookies,
|
extraCookies,
|
||||||
dbUserId,
|
|
||||||
};
|
};
|
||||||
if (useLocal) {
|
if (useLocal) {
|
||||||
return yield (0, api_send_email_code_1.default)(apiSendEmailCodeParams);
|
return yield (0, api_send_email_code_1.default)(apiSendEmailCodeParams);
|
||||||
|
@ -2,4 +2,4 @@ import { APIResponseObject, APISendEmailCodeFunctionParams } from "../../../type
|
|||||||
/**
|
/**
|
||||||
* # Send Email Login Code
|
* # Send Email Login Code
|
||||||
*/
|
*/
|
||||||
export default function apiSendEmailCode({ email, database, email_login_field, mail_domain, mail_port, sender, mail_username, mail_password, html, response, extraCookies, dbUserId, }: APISendEmailCodeFunctionParams): Promise<APIResponseObject>;
|
export default function apiSendEmailCode({ email, database, email_login_field, mail_domain, mail_port, sender, mail_username, mail_password, html, response, extraCookies, }: APISendEmailCodeFunctionParams): Promise<APIResponseObject>;
|
||||||
|
@ -18,26 +18,24 @@ const nodemailer_1 = __importDefault(require("nodemailer"));
|
|||||||
const get_auth_cookie_names_1 = __importDefault(require("../../backend/cookies/get-auth-cookie-names"));
|
const get_auth_cookie_names_1 = __importDefault(require("../../backend/cookies/get-auth-cookie-names"));
|
||||||
const encrypt_1 = __importDefault(require("../../dsql/encrypt"));
|
const encrypt_1 = __importDefault(require("../../dsql/encrypt"));
|
||||||
const serialize_cookies_1 = __importDefault(require("../../../utils/serialize-cookies"));
|
const serialize_cookies_1 = __importDefault(require("../../../utils/serialize-cookies"));
|
||||||
const grab_db_full_name_1 = __importDefault(require("../../../utils/grab-db-full-name"));
|
|
||||||
/**
|
/**
|
||||||
* # Send Email Login Code
|
* # Send Email Login Code
|
||||||
*/
|
*/
|
||||||
function apiSendEmailCode(_a) {
|
function apiSendEmailCode(_a) {
|
||||||
return __awaiter(this, arguments, void 0, function* ({ email, database, email_login_field, mail_domain, mail_port, sender, mail_username, mail_password, html, response, extraCookies, dbUserId, }) {
|
return __awaiter(this, arguments, void 0, function* ({ email, database, email_login_field, mail_domain, mail_port, sender, mail_username, mail_password, html, response, extraCookies, }) {
|
||||||
if (email === null || email === void 0 ? void 0 : email.match(/ /)) {
|
if (email === null || email === void 0 ? void 0 : email.match(/ /)) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
msg: "Invalid Email/Password format",
|
msg: "Invalid Email/Password format",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const dbFullName = (0, grab_db_full_name_1.default)({ dbName: database, userId: dbUserId });
|
|
||||||
const createdAt = Date.now();
|
const createdAt = Date.now();
|
||||||
const foundUserQuery = `SELECT * FROM users WHERE email = ?`;
|
const foundUserQuery = `SELECT * FROM users WHERE email = ?`;
|
||||||
const foundUserValues = [email];
|
const foundUserValues = [email];
|
||||||
let foundUser = (yield (0, dbHandler_1.default)({
|
let foundUser = (yield (0, dbHandler_1.default)({
|
||||||
query: foundUserQuery,
|
query: foundUserQuery,
|
||||||
values: foundUserValues,
|
values: foundUserValues,
|
||||||
database: dbFullName,
|
database,
|
||||||
}));
|
}));
|
||||||
if (!foundUser || !foundUser[0]) {
|
if (!foundUser || !foundUser[0]) {
|
||||||
return {
|
return {
|
||||||
@ -83,7 +81,7 @@ function apiSendEmailCode(_a) {
|
|||||||
yield (0, dbHandler_1.default)({
|
yield (0, dbHandler_1.default)({
|
||||||
query: setTempCodeQuery,
|
query: setTempCodeQuery,
|
||||||
values: setTempCodeValues,
|
values: setTempCodeValues,
|
||||||
database: dbFullName,
|
database,
|
||||||
});
|
});
|
||||||
const resObject = {
|
const resObject = {
|
||||||
success: true,
|
success: true,
|
||||||
|
2
dist/package-shared/types/index.d.ts
vendored
2
dist/package-shared/types/index.d.ts
vendored
@ -1858,7 +1858,6 @@ export type APISendEmailCodeFunctionParams = {
|
|||||||
[s: string]: any;
|
[s: string]: any;
|
||||||
};
|
};
|
||||||
extraCookies?: CookieObject[];
|
extraCookies?: CookieObject[];
|
||||||
dbUserId?: string | number;
|
|
||||||
};
|
};
|
||||||
export type SendEmailCodeParams = {
|
export type SendEmailCodeParams = {
|
||||||
apiKey?: string;
|
apiKey?: string;
|
||||||
@ -1876,7 +1875,6 @@ export type SendEmailCodeParams = {
|
|||||||
extraCookies?: CookieObject[];
|
extraCookies?: CookieObject[];
|
||||||
useLocal?: boolean;
|
useLocal?: boolean;
|
||||||
apiVersion?: string;
|
apiVersion?: string;
|
||||||
dbUserId?: string | number;
|
|
||||||
/**
|
/**
|
||||||
* HTML string with {{code}} placeholder for the code
|
* HTML string with {{code}} placeholder for the code
|
||||||
*/
|
*/
|
||||||
|
@ -27,7 +27,6 @@ export default async function sendEmailCode(
|
|||||||
extraCookies,
|
extraCookies,
|
||||||
useLocal,
|
useLocal,
|
||||||
apiVersion,
|
apiVersion,
|
||||||
dbUserId,
|
|
||||||
html,
|
html,
|
||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
@ -52,7 +51,6 @@ export default async function sendEmailCode(
|
|||||||
sender,
|
sender,
|
||||||
response,
|
response,
|
||||||
extraCookies,
|
extraCookies,
|
||||||
dbUserId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (useLocal) {
|
if (useLocal) {
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
APISendEmailCodeFunctionParams,
|
APISendEmailCodeFunctionParams,
|
||||||
CookieObject,
|
CookieObject,
|
||||||
} from "../../../types";
|
} from "../../../types";
|
||||||
import grabDbFullName from "../../../utils/grab-db-full-name";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* # Send Email Login Code
|
* # Send Email Login Code
|
||||||
@ -25,7 +24,6 @@ export default async function apiSendEmailCode({
|
|||||||
html,
|
html,
|
||||||
response,
|
response,
|
||||||
extraCookies,
|
extraCookies,
|
||||||
dbUserId,
|
|
||||||
}: APISendEmailCodeFunctionParams): Promise<APIResponseObject> {
|
}: APISendEmailCodeFunctionParams): Promise<APIResponseObject> {
|
||||||
if (email?.match(/ /)) {
|
if (email?.match(/ /)) {
|
||||||
return {
|
return {
|
||||||
@ -34,8 +32,6 @@ export default async function apiSendEmailCode({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const dbFullName = grabDbFullName({ dbName: database, userId: dbUserId });
|
|
||||||
|
|
||||||
const createdAt = Date.now();
|
const createdAt = Date.now();
|
||||||
|
|
||||||
const foundUserQuery = `SELECT * FROM users WHERE email = ?`;
|
const foundUserQuery = `SELECT * FROM users WHERE email = ?`;
|
||||||
@ -44,7 +40,7 @@ export default async function apiSendEmailCode({
|
|||||||
let foundUser = (await dbHandler({
|
let foundUser = (await dbHandler({
|
||||||
query: foundUserQuery,
|
query: foundUserQuery,
|
||||||
values: foundUserValues,
|
values: foundUserValues,
|
||||||
database: dbFullName,
|
database,
|
||||||
})) as any[];
|
})) as any[];
|
||||||
|
|
||||||
if (!foundUser || !foundUser[0]) {
|
if (!foundUser || !foundUser[0]) {
|
||||||
@ -101,7 +97,7 @@ export default async function apiSendEmailCode({
|
|||||||
await dbHandler({
|
await dbHandler({
|
||||||
query: setTempCodeQuery,
|
query: setTempCodeQuery,
|
||||||
values: setTempCodeValues,
|
values: setTempCodeValues,
|
||||||
database: dbFullName,
|
database,
|
||||||
});
|
});
|
||||||
|
|
||||||
const resObject: APIResponseObject = {
|
const resObject: APIResponseObject = {
|
||||||
|
@ -2406,7 +2406,6 @@ export type APISendEmailCodeFunctionParams = {
|
|||||||
html: string;
|
html: string;
|
||||||
response?: ServerResponse & { [s: string]: any };
|
response?: ServerResponse & { [s: string]: any };
|
||||||
extraCookies?: CookieObject[];
|
extraCookies?: CookieObject[];
|
||||||
dbUserId?: string | number;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SendEmailCodeParams = {
|
export type SendEmailCodeParams = {
|
||||||
@ -2423,7 +2422,6 @@ export type SendEmailCodeParams = {
|
|||||||
extraCookies?: CookieObject[];
|
extraCookies?: CookieObject[];
|
||||||
useLocal?: boolean;
|
useLocal?: boolean;
|
||||||
apiVersion?: string;
|
apiVersion?: string;
|
||||||
dbUserId?: string | number;
|
|
||||||
/**
|
/**
|
||||||
* HTML string with {{code}} placeholder for the code
|
* HTML string with {{code}} placeholder for the code
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "5.0.8",
|
"version": "5.0.9",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user