Updates
This commit is contained in:
@@ -2,4 +2,4 @@ import { APIResponseObject, GoogleAuthParams } from "../../../types";
|
||||
/**
|
||||
* # SERVER FUNCTION: Login with google Function
|
||||
*/
|
||||
export default function googleAuth({ apiKey, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, secureCookie, loginOnly, useLocal, apiVersion, skipWriteAuthFile, cleanupTokens, }: GoogleAuthParams): Promise<APIResponseObject>;
|
||||
export default function googleAuth({ apiKey, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, debug, secureCookie, loginOnly, useLocal, apiVersion, skipWriteAuthFile, cleanupTokens, }: GoogleAuthParams): Promise<APIResponseObject>;
|
||||
|
||||
+1
-2
@@ -21,7 +21,7 @@ const post_login_response_handler_1 = __importDefault(require("../../../function
|
||||
* # SERVER FUNCTION: Login with google Function
|
||||
*/
|
||||
function googleAuth(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ apiKey, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, secureCookie, loginOnly, useLocal, apiVersion, skipWriteAuthFile, cleanupTokens, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ apiKey, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, debug, secureCookie, loginOnly, useLocal, apiVersion, skipWriteAuthFile, cleanupTokens, }) {
|
||||
const finalEncryptionKey = encryptionKey || process.env.DSQL_ENCRYPTION_PASSWORD;
|
||||
const finalEncryptionSalt = encryptionSalt || process.env.DSQL_ENCRYPTION_SALT;
|
||||
if (!(finalEncryptionKey === null || finalEncryptionKey === void 0 ? void 0 : finalEncryptionKey.match(/.{8,}/))) {
|
||||
@@ -65,7 +65,6 @@ function googleAuth(_a) {
|
||||
debug,
|
||||
loginOnly,
|
||||
database,
|
||||
apiUserId: apiUserID || process.env.DSQL_API_USER_ID,
|
||||
};
|
||||
if (useLocal) {
|
||||
if (debug) {
|
||||
|
||||
@@ -2,4 +2,4 @@ import { APIResponseObject, HandleSocialDbFunctionParams } from "../../../types"
|
||||
/**
|
||||
* # Handle Social DB
|
||||
*/
|
||||
export default function handleSocialDb({ database, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, apiUserId, }: HandleSocialDbFunctionParams): Promise<APIResponseObject>;
|
||||
export default function handleSocialDb({ database, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, }: HandleSocialDbFunctionParams): Promise<APIResponseObject>;
|
||||
|
||||
@@ -19,18 +19,14 @@ const dbHandler_1 = __importDefault(require("../../backend/dbHandler"));
|
||||
const encrypt_1 = __importDefault(require("../../dsql/encrypt"));
|
||||
const addDbEntry_1 = __importDefault(require("../../backend/db/addDbEntry"));
|
||||
const loginSocialUser_1 = __importDefault(require("./loginSocialUser"));
|
||||
const grab_db_full_name_1 = __importDefault(require("../../../utils/grab-db-full-name"));
|
||||
/**
|
||||
* # Handle Social DB
|
||||
*/
|
||||
function handleSocialDb(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ database, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, apiUserId, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ database, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, }) {
|
||||
var _b;
|
||||
try {
|
||||
const finalDbName = (0, grab_db_full_name_1.default)({
|
||||
dbName: database,
|
||||
userId: apiUserId,
|
||||
});
|
||||
const finalDbName = database;
|
||||
const existingSocialUserQUery = `SELECT * FROM users WHERE email = ? AND social_login='1' AND social_platform = ? `;
|
||||
const existingSocialUserValues = [email, social_platform];
|
||||
if (debug) {
|
||||
|
||||
@@ -3,4 +3,4 @@ import { APIResponseObject } from "../../../../types";
|
||||
/**
|
||||
* # API google login
|
||||
*/
|
||||
export default function apiGoogleLogin({ token, database, additionalFields, additionalData, debug, loginOnly, apiUserId, }: APIGoogleLoginFunctionParams): Promise<APIResponseObject>;
|
||||
export default function apiGoogleLogin({ token, database, additionalFields, additionalData, debug, loginOnly, }: APIGoogleLoginFunctionParams): Promise<APIResponseObject>;
|
||||
|
||||
@@ -20,7 +20,7 @@ const ejson_1 = __importDefault(require("../../../../utils/ejson"));
|
||||
* # API google login
|
||||
*/
|
||||
function apiGoogleLogin(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ token, database, additionalFields, additionalData, debug, loginOnly, apiUserId, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ token, database, additionalFields, additionalData, debug, loginOnly, }) {
|
||||
try {
|
||||
const gUser = yield new Promise((resolve, reject) => {
|
||||
https_1.default
|
||||
@@ -71,7 +71,6 @@ function apiGoogleLogin(_a) {
|
||||
additionalFields,
|
||||
debug,
|
||||
loginOnly,
|
||||
apiUserId,
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
Vendored
-3
@@ -968,7 +968,6 @@ export type APIGoogleLoginFunctionParams = {
|
||||
};
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
apiUserId?: string | number;
|
||||
};
|
||||
export type APIGoogleLoginFunction = (params: APIGoogleLoginFunctionParams) => Promise<APILoginFunctionReturn>;
|
||||
/**
|
||||
@@ -985,7 +984,6 @@ export type HandleSocialDbFunctionParams = {
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
social_id?: string | number;
|
||||
apiUserId?: string | number;
|
||||
};
|
||||
export type HandleSocialDbFunctionReturn = {
|
||||
success: boolean;
|
||||
@@ -1925,7 +1923,6 @@ export type GoogleAuthParams = {
|
||||
additionalData?: {
|
||||
[s: string]: string | number;
|
||||
};
|
||||
apiUserID?: string | number;
|
||||
debug?: boolean;
|
||||
secureCookie?: boolean;
|
||||
loginOnly?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user