Sfoglia il codice sorgente

[add] login now working

B Thibault 8 anni fa
parent
commit
39fe4a8a81
4 ha cambiato i file con 3 aggiunte e 17 eliminazioni
  1. 1 0
      .gitignore
  2. 0 14
      srv/sessions.json
  3. 2 2
      srv/src/url.js
  4. 0 1
      srv/template/login.js

+ 1 - 0
.gitignore

@@ -3,6 +3,7 @@
 cli/closure-compiler-v*.jar
 /srv/config.js
 /srv/database.sqlite
+/srv/sessions.json
 
 # cache
 store.json

+ 0 - 14
srv/sessions.json

@@ -1,14 +0,0 @@
-{
-  "index": [
-    {
-      "key": "d2f3a7159804e6f6f5f9eb830c672730",
-      "val": {
-        "sessId": "d2f3a7159804e6f6f5f9eb830c672730",
-        "accountId": 1,
-        "modifiedAt": 1498151437428
-      },
-      "life": 1498237838587,
-      "tags": []
-    }
-  ]
-}

+ 2 - 2
srv/src/url.js

@@ -69,12 +69,12 @@ function tryLoadTemplateFile(fileName) {
 function tryLoadTemplate() {
     var template;
 
-    if (!this.urlParts[0]) {
+    if (this.urlParts.length === 0) {
         template = tryLoadTemplateFile(__dirname +'/../template/index.js');
     } else if (this.urlParts[0][0] !== '_') {
         template = tryLoadTemplateFile(__dirname +'/../template/' +this.urlParts[0] +'.js');
     }
-    if (!template || (template.match && !template.match(this)) || (!template.match && this.urlParts[0].length > 1)) {
+    if (!template || (template.match && !template.match(this)) || (!template.match && this.urlParts.length && this.urlParts[0].length > 1)) {
         return false;
     }
     this.template = template;

+ 0 - 1
srv/template/login.js

@@ -42,7 +42,6 @@ function checkTokens(service, req, cb) {
                             } else {
                                 var account = accountManager.createAccount();
                                 account.authGoogleUserId = id;
-                                accountManager.save(account);
                                 accountManager.save(account, () => { cb(account); });
                             }
                         });