Updates
This commit is contained in:
+1
-2
@@ -21,7 +21,7 @@ const query_dsql_api_1 = __importDefault(require("../../functions/api/query-dsql
|
||||
*/
|
||||
function sendEmailCode(params) {
|
||||
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 emailLoginTempCodeFieldName = temp_code_field_name
|
||||
? temp_code_field_name
|
||||
@@ -40,7 +40,6 @@ function sendEmailCode(params) {
|
||||
sender,
|
||||
response,
|
||||
extraCookies,
|
||||
dbUserId,
|
||||
};
|
||||
if (useLocal) {
|
||||
return yield (0, api_send_email_code_1.default)(apiSendEmailCodeParams);
|
||||
|
||||
@@ -2,4 +2,4 @@ import { APIResponseObject, APISendEmailCodeFunctionParams } from "../../../type
|
||||
/**
|
||||
* # 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 encrypt_1 = __importDefault(require("../../dsql/encrypt"));
|
||||
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
|
||||
*/
|
||||
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(/ /)) {
|
||||
return {
|
||||
success: false,
|
||||
msg: "Invalid Email/Password format",
|
||||
};
|
||||
}
|
||||
const dbFullName = (0, grab_db_full_name_1.default)({ dbName: database, userId: dbUserId });
|
||||
const createdAt = Date.now();
|
||||
const foundUserQuery = `SELECT * FROM users WHERE email = ?`;
|
||||
const foundUserValues = [email];
|
||||
let foundUser = (yield (0, dbHandler_1.default)({
|
||||
query: foundUserQuery,
|
||||
values: foundUserValues,
|
||||
database: dbFullName,
|
||||
database,
|
||||
}));
|
||||
if (!foundUser || !foundUser[0]) {
|
||||
return {
|
||||
@@ -83,7 +81,7 @@ function apiSendEmailCode(_a) {
|
||||
yield (0, dbHandler_1.default)({
|
||||
query: setTempCodeQuery,
|
||||
values: setTempCodeValues,
|
||||
database: dbFullName,
|
||||
database,
|
||||
});
|
||||
const resObject = {
|
||||
success: true,
|
||||
|
||||
Vendored
-2
@@ -1858,7 +1858,6 @@ export type APISendEmailCodeFunctionParams = {
|
||||
[s: string]: any;
|
||||
};
|
||||
extraCookies?: CookieObject[];
|
||||
dbUserId?: string | number;
|
||||
};
|
||||
export type SendEmailCodeParams = {
|
||||
apiKey?: string;
|
||||
@@ -1876,7 +1875,6 @@ export type SendEmailCodeParams = {
|
||||
extraCookies?: CookieObject[];
|
||||
useLocal?: boolean;
|
||||
apiVersion?: string;
|
||||
dbUserId?: string | number;
|
||||
/**
|
||||
* HTML string with {{code}} placeholder for the code
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user