Browse Source

fix: on github login, if email exists but not linked then user is alerted

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 4 years ago
parent
commit
26a484dc18
1 changed files with 7 additions and 5 deletions
  1. 7 5
      backend/logic/app.js

+ 7 - 5
backend/logic/app.js

@@ -273,7 +273,7 @@ class AppModule extends CoreClass {
                         (user, next) => {
                             if (user)
                                 return next(
-                                    "An account with that username already exists."
+                                    `An account with that username already exists.`
                                 );
 
                             request.get(
@@ -315,10 +315,12 @@ class AppModule extends CoreClass {
                         },
 
                         (user, _id, next) => {
-                            if (user)
-                                return next(
-                                    "An account with that email address already exists."
-                                );
+                            if (user) {
+                                if (Object.keys(JSON.parse(user.services.github)).length === 0)
+                                    return next(`An account with that email address exists, but is not linked to GitHub.`)    
+                                else
+                                    return next(`An account with that email address already exists.`);
+                            }
 
                             next(null, {
                                 _id, //TODO Check if exists