From 5aab7d1eb6f24e0402ed51bd49084f786f39c8dc Mon Sep 17 00:00:00 2001 From: Tben Date: Mon, 7 Aug 2023 15:34:25 +0100 Subject: [PATCH] updates --- package.json | 2 +- types/user.td.js | 1 + users/social/github-auth.js | 12 +++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 377bb28..e888814 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.3.0", + "version": "1.3.1", "description": "Cloud-based SQL data management tool", "main": "index.js", "scripts": { diff --git a/types/user.td.js b/types/user.td.js index fe8dd43..96e865b 100644 --- a/types/user.td.js +++ b/types/user.td.js @@ -9,6 +9,7 @@ * @property {number} social_login - 0 or 1 => is this user a social user(1) or not(0) * @property {string} csrf_k - CSRF key * @property {boolean} logged_in_status - Is user logged in or not + * @property {boolean} [date] - Time of session creation */ module.exports = { DATASQUIREL_LoggedInUser }; diff --git a/users/social/github-auth.js b/users/social/github-auth.js index f76a7cb..a292b56 100644 --- a/users/social/github-auth.js +++ b/users/social/github-auth.js @@ -152,7 +152,17 @@ async function githubAuth({ key, code, email, database, clientId, clientSecret, }); response.on("end", function () { - resolve(JSON.parse(str)); + try { + resolve(JSON.parse(str)); + } catch (error) { + console.log(error.message); + + resolve({ + success: false, + user: null, + msg: "Something went wrong", + }); + } }); response.on("error", (err) => {