Updates
This commit is contained in:
@@ -15,7 +15,7 @@ type Param = {
|
||||
key: string;
|
||||
code: string;
|
||||
email: string | null;
|
||||
database: string;
|
||||
database?: string;
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
response: http.ServerResponse;
|
||||
|
||||
+4
-2
@@ -19,6 +19,7 @@ const encrypt_1 = __importDefault(require("../../../functions/dsql/encrypt"));
|
||||
const grab_host_names_1 = __importDefault(require("../../../utils/grab-host-names"));
|
||||
const api_github_login_1 = __importDefault(require("../../../functions/api/users/social/api-github-login"));
|
||||
const grab_cookie_expirt_date_1 = __importDefault(require("../../../utils/grab-cookie-expirt-date"));
|
||||
const grab_db_names_1 = __importDefault(require("../../../utils/grab-db-names"));
|
||||
/**
|
||||
* # SERVER FUNCTION: Login with google Function
|
||||
*/
|
||||
@@ -62,7 +63,7 @@ function githubAuth(_a) {
|
||||
*
|
||||
* @description Look for local db settings in `.env` file and by pass the http request if available
|
||||
*/
|
||||
const { DSQL_DB_HOST, DSQL_DB_USERNAME, DSQL_DB_PASSWORD, DSQL_DB_NAME, DSQL_KEY, DSQL_REF_DB_NAME, DSQL_FULL_SYNC, } = process.env;
|
||||
const { DSQL_DB_HOST, DSQL_DB_USERNAME, DSQL_DB_PASSWORD, DSQL_DB_NAME } = process.env;
|
||||
if ((DSQL_DB_HOST === null || DSQL_DB_HOST === void 0 ? void 0 : DSQL_DB_HOST.match(/./)) &&
|
||||
(DSQL_DB_USERNAME === null || DSQL_DB_USERNAME === void 0 ? void 0 : DSQL_DB_USERNAME.match(/./)) &&
|
||||
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
|
||||
@@ -74,13 +75,14 @@ function githubAuth(_a) {
|
||||
dbSchema = JSON.parse(fs_1.default.readFileSync(localDbSchemaPath, "utf8"));
|
||||
}
|
||||
catch (error) { }
|
||||
const { dbFullName } = (0, grab_db_names_1.default)({ dbName: database });
|
||||
httpResponse = yield (0, api_github_login_1.default)({
|
||||
code,
|
||||
email: email || undefined,
|
||||
clientId,
|
||||
clientSecret,
|
||||
additionalFields,
|
||||
database: DSQL_DB_NAME,
|
||||
database: dbFullName,
|
||||
additionalData,
|
||||
});
|
||||
}
|
||||
|
||||
+1
-2
@@ -13,7 +13,6 @@ type Param = {
|
||||
encryptionSalt?: string;
|
||||
level?: "deep" | "normal";
|
||||
database?: string;
|
||||
dsqlUserId?: string | number;
|
||||
expiry?: number;
|
||||
csrfHeaderName?: string;
|
||||
debug?: boolean;
|
||||
@@ -25,5 +24,5 @@ type Param = {
|
||||
* @description This Function takes in a request object and returns a user object
|
||||
* with the user's data
|
||||
*/
|
||||
export default function userAuth({ request, req, encryptionKey, encryptionSalt, level, database, dsqlUserId, encryptedUserString, expiry, cookieString, csrfHeaderName, debug, skipFileCheck, }: Param): AuthenticatedUser;
|
||||
export default function userAuth({ request, req, encryptionKey, encryptionSalt, level, database, encryptedUserString, expiry, cookieString, csrfHeaderName, debug, skipFileCheck, }: Param): AuthenticatedUser;
|
||||
export {};
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ const yearInMilliseconds = dayInMilliseconds * 365;
|
||||
* @description This Function takes in a request object and returns a user object
|
||||
* with the user's data
|
||||
*/
|
||||
function userAuth({ request, req, encryptionKey, encryptionSalt, level, database, dsqlUserId, encryptedUserString, expiry = weekInMilliseconds, cookieString, csrfHeaderName, debug, skipFileCheck, }) {
|
||||
function userAuth({ request, req, encryptionKey, encryptionSalt, level, database, encryptedUserString, expiry = weekInMilliseconds, cookieString, csrfHeaderName, debug, skipFileCheck, }) {
|
||||
try {
|
||||
const finalRequest = req || request;
|
||||
const cookies = (0, parseCookies_1.default)({
|
||||
@@ -37,7 +37,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
|
||||
});
|
||||
}
|
||||
const keyNames = (0, get_auth_cookie_names_1.default)({
|
||||
database: database || process.env.DSQL_DB_NAME,
|
||||
database,
|
||||
});
|
||||
if (debug) {
|
||||
(0, debug_log_1.default)({
|
||||
|
||||
Reference in New Issue
Block a user