Passed
Push — master ( d90896...4dd415 )
by Elia
01:13
created
_config/headers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $http_origin = $_SERVER['HTTP_ORIGIN'];
4
-if ($http_origin == "http://localhost:8080" || $http_origin == "https://minska.eliareutlinger.ch"){
4
+if ($http_origin == "http://localhost:8080" || $http_origin == "https://minska.eliareutlinger.ch") {
5 5
     header("Access-Control-Allow-Origin: $http_origin");
6 6
 }
7 7
 
Please login to merge, or discard this patch.
user/logout/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,6 +4,6 @@
 block discarded – undo
4 4
 include_once '../../_config/core.php';
5 5
 
6 6
 $jwt = "";
7
-if(setAuth($jwt, time()-3600)){
7
+if (setAuth($jwt, time() - 3600)) {
8 8
     returnSuccess();
9 9
 }
Please login to merge, or discard this patch.
user/login/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
     );
44 44
 
45 45
     $jwt = JWT::encode($token, $token_conf['secret']);
46
-    if(setAuth($jwt, $token_conf['expireDefault'])){
46
+    if (setAuth($jwt, $token_conf['expireDefault'])) {
47 47
         returnSuccess();
48 48
     }
49 49
 
Please login to merge, or discard this patch.
user/update/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
                 );
58 58
 
59 59
                 $jwt = JWT::encode($token, $token_conf['secret']);
60
-                if(setAuth($jwt, $token_conf['expireDefault'])){
60
+                if (setAuth($jwt, $token_conf['expireDefault'])) {
61 61
                     returnSuccess();
62 62
                 }
63 63
 
Please login to merge, or discard this patch.
_config/core.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
     "expireDefault" => time() + (604800),
15 15
 );
16 16
 
17
-function setAuth($token, $expire){
17
+function setAuth($token, $expire) {
18 18
 
19 19
     //$domain = "localhost";
20 20
     $domain = ".eliareutlinger.ch";
21 21
     $secure = false;
22
-    if(isset($_SERVER['HTTPS'])){
22
+    if (isset($_SERVER['HTTPS'])) {
23 23
         $secure = true;
24 24
     }
25 25
 
26
-    $appCookie = setcookie ("appToken", $token, $expire, "/", $domain, $secure, false);
27
-    $secureCookie = setcookie ("secureToken", $token, $expire, "/", $domain, $secure, true);
26
+    $appCookie = setcookie("appToken", $token, $expire, "/", $domain, $secure, false);
27
+    $secureCookie = setcookie("secureToken", $token, $expire, "/", $domain, $secure, true);
28 28
 
29
-    if($appCookie && $secureCookie){
29
+    if ($appCookie && $secureCookie) {
30 30
         return true;
31 31
     }
32 32
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         list($type, $data) = explode(" ", getallheaders()['Authorization'], 2);
41 41
         if (strcasecmp($type, "Bearer") == 0) {
42 42
 
43
-            if($_COOKIE["appToken"] === $data){
43
+            if ($_COOKIE["appToken"] === $data) {
44 44
                 return $_COOKIE["appToken"];
45 45
             } else {
46 46
                 returnForbidden("Tokens not correct");
Please login to merge, or discard this patch.