@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | */ |
56 | 56 | private function addToBadLoginTries($user):void |
57 | 57 | { |
58 | - $badLoginTries = $user->bad_login_tries +1; |
|
59 | - $sql =" |
|
58 | + $badLoginTries = $user->bad_login_tries + 1; |
|
59 | + $sql = " |
|
60 | 60 | UPDATE $this->userTbl |
61 | 61 | SET |
62 | 62 | bad_login_time = NOW(), |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function resetBadLogin($user):void |
78 | 78 | { |
79 | - $sql=" |
|
79 | + $sql = " |
|
80 | 80 | UPDATE $this->userTbl |
81 | 81 | SET |
82 | 82 | bad_login_tries = 0 |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | |
90 | 90 | private function isAccountPasswordBlocked($user) |
91 | 91 | { |
92 | - if($user->bad_login_tries < Constant::NUMBER_OF_BAD_PASSWORD_TRIES) { |
|
92 | + if ($user->bad_login_tries < Constant::NUMBER_OF_BAD_PASSWORD_TRIES) { |
|
93 | 93 | //not enough bad tries yet |
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | |
97 | 97 | $blockTime = strtotime($user->bad_login_time); |
98 | 98 | $currentTime = time(); |
99 | - if($currentTime-$blockTime > Constant::LOCKOUT_MINUTES*60) |
|
99 | + if ($currentTime - $blockTime > Constant::LOCKOUT_MINUTES * 60) |
|
100 | 100 | { |
101 | 101 | //we have outlived the timeout, connection authorised |
102 | 102 | return false; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | //check if email is valid for sanity |
135 | 135 | if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
136 | 136 | $email = htmlspecialchars($email); |
137 | - throw new BlogocException("invalid email " . $email); |
|
137 | + throw new BlogocException("invalid email ".$email); |
|
138 | 138 | } |
139 | 139 | $sql = $this->baseSqlSelect(); |
140 | 140 | $sql .= " |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $this->bind(':roles_idroles', 1); |
183 | 183 | $this->execute(); |
184 | 184 | |
185 | - return (int)$this->dbh->lastInsertId(); |
|
185 | + return (int) $this->dbh->lastInsertId(); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -200,20 +200,20 @@ discard block |
||
200 | 200 | |
201 | 201 | $user = $this->getUserDetailsByEmail($email); |
202 | 202 | |
203 | - if($user === false) //no user exists |
|
203 | + if ($user === false) //no user exists |
|
204 | 204 | { |
205 | 205 | $response->message = "email doesn't exist, register a new account?"; |
206 | 206 | return $response; |
207 | 207 | } |
208 | 208 | |
209 | 209 | //check if the user has validated his email |
210 | - if($user->locked_out) |
|
210 | + if ($user->locked_out) |
|
211 | 211 | { |
212 | 212 | $response->message = "the email has not been verified, please check your inbox or click on 'reset your password'"; |
213 | 213 | return $response; |
214 | 214 | } |
215 | 215 | |
216 | - if($this->isAccountPasswordBlocked($user)) |
|
216 | + if ($this->isAccountPasswordBlocked($user)) |
|
217 | 217 | { |
218 | 218 | $response->message = "too many bad passwords, account is blocked for ".Constant::LOCKOUT_MINUTES." minutes"; |
219 | 219 | return $response; |