First Commit
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 1799;
|
||||
exports.ids = [1799];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 9538:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("datasquirel");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3785:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("generate-password");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5184:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("nodemailer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3107:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7839);
|
||||
/* harmony import */ var _functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const { facebookUserId , facebookUserImage , facebookUserFullName , facebookUserFirstName , facebookUserLastName , facebookUserEmail , supEmail , } = req.body;
|
||||
const { invite } = req.query;
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ try {
|
||||
/**
|
||||
* Create new user folder and file
|
||||
*
|
||||
* @description Create new user folder and file
|
||||
*/ const loggedInFacebookUser = await _functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
email: facebookUserEmail,
|
||||
payload: {
|
||||
email: facebookUserEmail,
|
||||
first_name: facebookUserFirstName,
|
||||
last_name: facebookUserLastName,
|
||||
social_id: facebookUserId,
|
||||
social_platform: "facebook",
|
||||
image: facebookUserImage,
|
||||
image_thumbnail: facebookUserImage,
|
||||
username: `facebook-user-${facebookUserId}`
|
||||
},
|
||||
social_platform: "facebook",
|
||||
res: res,
|
||||
social_id: facebookUserId,
|
||||
invitation: invite,
|
||||
supEmail: supEmail
|
||||
});
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
res.json(loggedInFacebookUser);
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error) {
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
console.log(error.message);
|
||||
// serverError({
|
||||
// component: "/api/social-login/github-auth/catch-error",
|
||||
// message: error.message,
|
||||
// user: user,
|
||||
// });
|
||||
res.json({
|
||||
success: false,
|
||||
msg: "Failed!"
|
||||
});
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,3017,3403,7547,5886,5338,8326,1311,6926,7487,613,4294,7839], () => (__webpack_exec__(3107)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,231 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 3115;
|
||||
exports.ids = [3115];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 9538:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("datasquirel");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3785:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("generate-password");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5184:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("nodemailer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5687:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("https");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7310:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("url");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5389:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7839);
|
||||
/* harmony import */ var _functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _shell_utils_camelJoinedtoCamelSpace__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2127);
|
||||
/* harmony import */ var _shell_utils_camelJoinedtoCamelSpace__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_shell_utils_camelJoinedtoCamelSpace__WEBPACK_IMPORTED_MODULE_1__);
|
||||
// @ts-check
|
||||
|
||||
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/ const githubLogin = __webpack_require__(6069);
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "GET") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const { code , email , invite } = req.query;
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ try {
|
||||
/**
|
||||
* Create new user folder and file
|
||||
*
|
||||
* @description Create new user folder and file
|
||||
*/ const gitHubUser = await githubLogin({
|
||||
code: code?.toString() || "",
|
||||
clientId: process.env.DSQL_GITHUB_ID || "",
|
||||
clientSecret: process.env.DSQL_GITHUB_SECRET || ""
|
||||
});
|
||||
if (!gitHubUser) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "No github user returned"
|
||||
});
|
||||
}
|
||||
if (!gitHubUser?.email && !email) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Github User Email not present"
|
||||
});
|
||||
}
|
||||
const loggedInGithubUser = await _functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
email: gitHubUser.email,
|
||||
payload: {
|
||||
email: gitHubUser.email,
|
||||
first_name: _shell_utils_camelJoinedtoCamelSpace__WEBPACK_IMPORTED_MODULE_1___default()(gitHubUser.login)?.split(" ")[0],
|
||||
last_name: _shell_utils_camelJoinedtoCamelSpace__WEBPACK_IMPORTED_MODULE_1___default()(gitHubUser.login)?.split(" ")[1],
|
||||
social_id: gitHubUser.id,
|
||||
social_platform: "github",
|
||||
image: gitHubUser.avatar_url,
|
||||
image_thumbnail: gitHubUser.avatar_url,
|
||||
username: "github-user-" + gitHubUser.name
|
||||
},
|
||||
social_platform: "github",
|
||||
invitation: invite,
|
||||
res: res,
|
||||
social_id: gitHubUser.id,
|
||||
supEmail: email ? email.toString() : undefined
|
||||
});
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
res.json(loggedInGithubUser);
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error) {
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
console.log("ERROR in 'github-auth' API route =>", error.message);
|
||||
// serverError({
|
||||
// component: "/api/social-login/github-auth/catch-error",
|
||||
// message: error.message,
|
||||
// user: user,
|
||||
// });
|
||||
res.json({
|
||||
success: false,
|
||||
msg: "Failed!"
|
||||
});
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,3017,3403,7547,5886,5338,8326,1311,6926,7487,613,4294,7839,722,9971], () => (__webpack_exec__(5389)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,265 @@
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 5288;
|
||||
exports.ids = [5288];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 9538:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("datasquirel");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3785:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("generate-password");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6781:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("google-auth-library");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5184:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("nodemailer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5382:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
// @ts-check
|
||||
const { createHmac } = __webpack_require__(6113);
|
||||
//
|
||||
/**
|
||||
* # Password Hash function
|
||||
* @param {string} password
|
||||
* @returns
|
||||
*/ function hashPassword(password) {
|
||||
const hmac = createHmac("sha512", process.env.DSQL_ENCRYPTION_PASSWORD || "");
|
||||
hmac.update(password);
|
||||
let hashed = hmac.digest("base64");
|
||||
return hashed;
|
||||
}
|
||||
exports.hashPassword = hashPassword; // export const comparePasswords = async (password) => {
|
||||
// const hmac = createHmac("sha512", process.env.DSQL_ENCRYPTION_PASSWORD);
|
||||
// hmac.update(password);
|
||||
// let hashed = hmac.digest("base64");
|
||||
// let dbPass = await global.DB_HANDLER(`SELECT * FROM users WHERE password = '${hashed}'`);
|
||||
// console.log(dbPass);
|
||||
// return dbPass;
|
||||
// };
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2666:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7839);
|
||||
/* harmony import */ var _functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/ const { OAuth2Client } = __webpack_require__(6781);
|
||||
const { hashPassword , } = __webpack_require__(5382);
|
||||
const serverError = __webpack_require__(2163);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const reqBody = req.body;
|
||||
const { invite } = req.query;
|
||||
const { token } = reqBody;
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ try {
|
||||
const client = new OAuth2Client("392696781563-imb0ddojfn6m4bdokjk5v80jn546t9tq.apps.googleusercontent.com");
|
||||
const ticket = await client.verifyIdToken({
|
||||
idToken: token,
|
||||
audience: "392696781563-imb0ddojfn6m4bdokjk5v80jn546t9tq.apps.googleusercontent.com"
|
||||
});
|
||||
const payload = ticket.getPayload();
|
||||
if (!payload || !payload.email_verified) {
|
||||
res.json({
|
||||
user: null,
|
||||
msg: "Invalid Credentials"
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { given_name , family_name , email , sub , picture , email_verified } = payload;
|
||||
if (!email) throw new Error("No Email");
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
/**
|
||||
* Create new user folder and file
|
||||
*
|
||||
* @description Create new user folder and file
|
||||
*/ const loggedInGoogleUser = await _functions_backend_social_login_handleSocialDb__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
email: email,
|
||||
payload: {
|
||||
email: email,
|
||||
first_name: given_name,
|
||||
last_name: family_name,
|
||||
social_id: sub,
|
||||
social_platform: "google",
|
||||
image: picture,
|
||||
image_thumbnail: picture,
|
||||
username: `google-user-${sub}`
|
||||
},
|
||||
social_platform: "google",
|
||||
res: res,
|
||||
social_id: sub,
|
||||
invitation: invite
|
||||
});
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
res.json(loggedInGoogleUser);
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error) {
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
console.log(error.message);
|
||||
// serverError({
|
||||
// component: "/api/social-login/github-auth/catch-error",
|
||||
// message: error.message,
|
||||
// user: user,
|
||||
// });
|
||||
res.json({
|
||||
success: false,
|
||||
msg: "Failed!"
|
||||
});
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,3017,3403,7547,5886,5338,8326,1311,6926,7487,613,4294,7839], () => (__webpack_exec__(2666)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 6267;
|
||||
exports.ids = [6267];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9986:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2224);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "GET") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ if (!req.query?.email?.toString()?.match(/^\S+$/)) {
|
||||
res.json({
|
||||
email: null
|
||||
});
|
||||
}
|
||||
let email = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default()(`SELECT email FROM users WHERE email=?`, [
|
||||
req.query.email,
|
||||
]);
|
||||
if (email && email[0]) {
|
||||
res.json({
|
||||
email: email
|
||||
});
|
||||
} else {
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
res.json({
|
||||
email: null
|
||||
});
|
||||
}
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
} //////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [2224], () => (__webpack_exec__(9986)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 5445;
|
||||
exports.ids = [5445];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8740:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2224);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "GET") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ const sanitizedReqBody = req.query;
|
||||
const { social_id , social_platform } = sanitizedReqBody;
|
||||
let socialId = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default()(`SELECT social_id FROM users WHERE social_id=? AND social_platform=?`, [
|
||||
social_id,
|
||||
social_platform
|
||||
]);
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
if (social_id && social_id[0]) {
|
||||
res.json({
|
||||
social_id: socialId
|
||||
});
|
||||
} else {
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
res.json({
|
||||
social_id: null
|
||||
});
|
||||
}
|
||||
} //////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [2224], () => (__webpack_exec__(8740)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 4828;
|
||||
exports.ids = [4828];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6750:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2224);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "GET") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ const sanitizedReqBody = req.query;
|
||||
const { social_id , social_platform } = sanitizedReqBody;
|
||||
let email = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default()(`SELECT email FROM users WHERE social_id=? AND social_platform=?`, [
|
||||
social_id,
|
||||
social_platform
|
||||
]);
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
if (email && email[0]) {
|
||||
res.json({
|
||||
email: email[0].email
|
||||
});
|
||||
} else {
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
res.json({
|
||||
email: null
|
||||
});
|
||||
}
|
||||
} //////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [2224], () => (__webpack_exec__(6750)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
+1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user