Updates
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user