| Conditions | 4 |
| Paths | 4 |
| Total Lines | 30 |
| Code Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | public function attempt(string $loginField,string $password) |
||
| 29 | { |
||
| 30 | $user = UserDataAccess::getUserLoginField($loginField); |
||
| 31 | if (!$user) { |
||
| 32 | return [ |
||
| 33 | 'type'=>'error', |
||
| 34 | 'message'=> 'User Not Exists', |
||
| 35 | ]; |
||
| 36 | } |
||
| 37 | $setting = Config::get('settings.auth'); |
||
| 38 | if($setting['2step']){ |
||
| 39 | $this->twoStepAuth(); |
||
| 40 | }else{ |
||
| 41 | if ($this->checkPass($password,$user->password)) { |
||
|
|
|||
| 42 | $_SESSION['user']['user_id'] = $user->id; |
||
| 43 | $_SESSION['user']['mobile'] = $user->mobile; |
||
| 44 | return [ |
||
| 45 | 'type'=>'success', |
||
| 46 | 'message'=> 'Logined', |
||
| 47 | ]; |
||
| 48 | }else{ |
||
| 49 | return [ |
||
| 50 | 'type'=>'error', |
||
| 51 | 'message'=> 'password mismatch', |
||
| 52 | ]; |
||
| 53 | } |
||
| 54 | } |
||
| 55 | return [ |
||
| 56 | 'type'=>'error', |
||
| 57 | 'message'=> 'problem!', |
||
| 58 | ]; |
||
| 83 | } |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.