Completed
Push — master ( 41ea8c...3bb2fe )
by Afshin
03:08
created
core/Helpers/Hash.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
 
9 9
 namespace Core\Helpers;
10 10
 
11
-class Hash{
11
+class Hash {
12 12
     /**
13 13
      * Receives a string password and hashes it.
14 14
      *
15 15
      * @param string $password
16 16
      * @return string $hash
17 17
      */
18
-    public static function hash($password){
18
+    public static function hash($password) {
19 19
 //        return (string)password_hash($password, PASSWORD_DEFAULT);
20 20
         return sha1(md5($password));
21 21
     }
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
      * @param string $hash
28 28
      * @return boolean If the hash was generated from the password
29 29
      */
30
-    public static function checkHash($string, $hash){
31
-        if( password_verify( $string, $hash ) ){
30
+    public static function checkHash($string, $hash) {
31
+        if (password_verify($string, $hash)) {
32 32
             return true;
33 33
         }
34 34
         return false;
Please login to merge, or discard this patch.
core/Services/AuthService.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         return isset($_SESSION['user']['user_id']);
26 26
     }
27 27
 
28
-    public function attempt(string $loginField,string $password)
28
+    public function attempt(string $loginField, string $password)
29 29
     {
30 30
         $user = UserDataAccess::getUserLoginField($loginField);
31 31
         if (!$user) {
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
             ];
36 36
         }
37 37
         $setting = Config::get('settings.auth');
38
-        if($setting['2step']){
38
+        if ($setting['2step']) {
39 39
             $this->twoStepAuth();
40
-        }else{
41
-            if ($this->checkPass($password,$user->password)) {
40
+        }else {
41
+            if ($this->checkPass($password, $user->password)) {
42 42
                 $_SESSION['user']['user_id'] = $user->id;
43 43
                 $_SESSION['user']['mobile'] = $user->mobile;
44 44
                 return [
45 45
                     'type'=>'success',
46 46
                     'message'=> 'Logined',
47 47
                 ];
48
-            }else{
48
+            }else {
49 49
                 return [
50 50
                     'type'=>'error',
51 51
                     'message'=> 'password mismatch',
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 
61 61
 
62 62
 
63
-    public function checkPass($password,$database_pass)
63
+    public function checkPass($password, $database_pass)
64 64
     {
65
-        if($database_pass == $password){
65
+        if ($database_pass == $password) {
66 66
             return true;
67 67
         }
68 68
         return false;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $setting = Config::get('settings.auth');
38 38
         if($setting['2step']){
39 39
             $this->twoStepAuth();
40
-        }else{
40
+        } else{
41 41
             if ($this->checkPass($password,$user->password)) {
42 42
                 $_SESSION['user']['user_id'] = $user->id;
43 43
                 $_SESSION['user']['mobile'] = $user->mobile;
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                     'type'=>'success',
46 46
                     'message'=> 'Logined',
47 47
                 ];
48
-            }else{
48
+            } else{
49 49
                 return [
50 50
                     'type'=>'error',
51 51
                     'message'=> 'password mismatch',
Please login to merge, or discard this patch.
migrations/20171130091220_Add_Password_To_Users_Table_Migration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     {
13 13
         Capsule::schema()->table('users', function($table)
14 14
         {
15
-            $table->string('password',128);
15
+            $table->string('password', 128);
16 16
         });
17 17
     }
18 18
 
Please login to merge, or discard this patch.