Bugfix
This commit is contained in:
parent
17fdf05382
commit
a1d2325156
@ -79,7 +79,7 @@ module.exports = async function apiSendEmailCode({
|
|||||||
|
|
||||||
let transporter = nodemailer.createTransport({
|
let transporter = nodemailer.createTransport({
|
||||||
host: mail_domain || process.env.DSQL_MAIL_HOST,
|
host: mail_domain || process.env.DSQL_MAIL_HOST,
|
||||||
port: mail_port || 465,
|
port: mail_port || process.env.DSQL_MAIL_PORT || 465,
|
||||||
secure: true,
|
secure: true,
|
||||||
auth: {
|
auth: {
|
||||||
user: mail_username || process.env.DSQL_MAIL_EMAIL,
|
user: mail_username || process.env.DSQL_MAIL_EMAIL,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "2.8.1",
|
"version": "2.8.2",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
22
users/send-email-code.d.ts
vendored
22
users/send-email-code.d.ts
vendored
@ -11,13 +11,11 @@ export = sendEmailCode;
|
|||||||
* @async
|
* @async
|
||||||
*
|
*
|
||||||
* @param {object} params - Single Param object containing params
|
* @param {object} params - Single Param object containing params
|
||||||
* @param {String} params.key - FULL ACCESS API Key
|
* @param {String} [params.key] - FULL ACCESS API Key
|
||||||
* @param {String} params.database - Target Database
|
* @param {String} [params.database] - Target Database
|
||||||
* @param {string} params.email Login Email/Username and Password
|
* @param {string} params.email Login Email/Username and Password
|
||||||
* @param {http.ServerResponse} params.response - Http response object
|
* @param {http.ServerResponse} [params.response] - Http response object
|
||||||
* @param {String} params.encryptionKey - Encryption Key
|
* @param {string} [params.temp_code_field_name] - Database table field name for temporary code
|
||||||
* @param {String} params.encryptionSalt - Encryption Salt
|
|
||||||
* @param {string} [params.temp_code_field] - Database table field name for temporary code
|
|
||||||
* @param {string} [params.mail_domain]
|
* @param {string} [params.mail_domain]
|
||||||
* @param {string} [params.mail_username]
|
* @param {string} [params.mail_username]
|
||||||
* @param {string} [params.mail_password]
|
* @param {string} [params.mail_password]
|
||||||
@ -28,14 +26,12 @@ export = sendEmailCode;
|
|||||||
*
|
*
|
||||||
* @returns { Promise<boolean>}
|
* @returns { Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
declare function sendEmailCode({ key, email, database, encryptionKey, encryptionSalt, temp_code_field, mail_domain, mail_password, mail_username, mail_port, sender, user_id, useLocal, }: {
|
declare function sendEmailCode({ key, email, database, temp_code_field_name, mail_domain, mail_password, mail_username, mail_port, sender, user_id, useLocal, }: {
|
||||||
key: string;
|
key?: string;
|
||||||
database: string;
|
database?: string;
|
||||||
email: string;
|
email: string;
|
||||||
response: http.ServerResponse;
|
response?: http.ServerResponse;
|
||||||
encryptionKey: string;
|
temp_code_field_name?: string;
|
||||||
encryptionSalt: string;
|
|
||||||
temp_code_field?: string;
|
|
||||||
mail_domain?: string;
|
mail_domain?: string;
|
||||||
mail_username?: string;
|
mail_username?: string;
|
||||||
mail_password?: string;
|
mail_password?: string;
|
||||||
|
@ -25,13 +25,11 @@ const apiSendEmailCode = require("../package-shared/functions/api/users/api-send
|
|||||||
* @async
|
* @async
|
||||||
*
|
*
|
||||||
* @param {object} params - Single Param object containing params
|
* @param {object} params - Single Param object containing params
|
||||||
* @param {String} params.key - FULL ACCESS API Key
|
* @param {String} [params.key] - FULL ACCESS API Key
|
||||||
* @param {String} params.database - Target Database
|
* @param {String} [params.database] - Target Database
|
||||||
* @param {string} params.email Login Email/Username and Password
|
* @param {string} params.email Login Email/Username and Password
|
||||||
* @param {http.ServerResponse} params.response - Http response object
|
* @param {http.ServerResponse} [params.response] - Http response object
|
||||||
* @param {String} params.encryptionKey - Encryption Key
|
* @param {string} [params.temp_code_field_name] - Database table field name for temporary code
|
||||||
* @param {String} params.encryptionSalt - Encryption Salt
|
|
||||||
* @param {string} [params.temp_code_field] - Database table field name for temporary code
|
|
||||||
* @param {string} [params.mail_domain]
|
* @param {string} [params.mail_domain]
|
||||||
* @param {string} [params.mail_username]
|
* @param {string} [params.mail_username]
|
||||||
* @param {string} [params.mail_password]
|
* @param {string} [params.mail_password]
|
||||||
@ -46,9 +44,7 @@ async function sendEmailCode({
|
|||||||
key,
|
key,
|
||||||
email,
|
email,
|
||||||
database,
|
database,
|
||||||
encryptionKey,
|
temp_code_field_name,
|
||||||
encryptionSalt,
|
|
||||||
temp_code_field,
|
|
||||||
mail_domain,
|
mail_domain,
|
||||||
mail_password,
|
mail_password,
|
||||||
mail_username,
|
mail_username,
|
||||||
@ -61,8 +57,8 @@ async function sendEmailCode({
|
|||||||
const { host, port, scheme } = grabedHostNames;
|
const { host, port, scheme } = grabedHostNames;
|
||||||
|
|
||||||
const defaultTempLoginFieldName = "temp_login_code";
|
const defaultTempLoginFieldName = "temp_login_code";
|
||||||
const emailLoginTempCodeFieldName = temp_code_field
|
const emailLoginTempCodeFieldName = temp_code_field_name
|
||||||
? temp_code_field
|
? temp_code_field_name
|
||||||
: defaultTempLoginFieldName;
|
: defaultTempLoginFieldName;
|
||||||
|
|
||||||
const emailHtml = fs.readFileSync(
|
const emailHtml = fs.readFileSync(
|
||||||
@ -70,31 +66,6 @@ async function sendEmailCode({
|
|||||||
"utf-8"
|
"utf-8"
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Encryption Keys
|
|
||||||
*
|
|
||||||
* @description Check Encryption Keys
|
|
||||||
*/
|
|
||||||
if (!encryptionKey?.match(/./)) {
|
|
||||||
console.log("DSQL Error => No Encryption Key Found!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!encryptionSalt?.match(/./)) {
|
|
||||||
console.log("DSQL Error => No Encryption Salt Found!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (encryptionKey.length < 24) {
|
|
||||||
console.log("DSQL Error => Encryption key less than 24 characters!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (encryptionSalt.length < 8) {
|
|
||||||
console.log("DSQL Error => Encryption Salt less than 8 characters!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize HTTP response variable
|
* Initialize HTTP response variable
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user