@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $account = $this->get_account(); |
| 152 | 152 | if (!empty($new_password)) { |
| 153 | 153 | // check if the new encrypted password was already used |
| 154 | - if ( !$this->check_password_reuse($new_password) |
|
| 154 | + if (!$this->check_password_reuse($new_password) |
|
| 155 | 155 | || !$this->check_password_strength($new_password)) { |
| 156 | 156 | return false; |
| 157 | 157 | } |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | public static function get_person_by_formdata(array $data) : ?midcom_db_person |
| 425 | 425 | { |
| 426 | - if ( empty($data['username']) |
|
| 426 | + if (empty($data['username']) |
|
| 427 | 427 | || empty($data['password'])) { |
| 428 | 428 | return null; |
| 429 | 429 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | * If the maximum number of attempts is reached and the oldest attempt |
| 473 | 473 | * on the stack is within our defined timeframe, we block the account |
| 474 | 474 | */ |
| 475 | - if ( count($attempts) >= $max_attempts |
|
| 475 | + if (count($attempts) >= $max_attempts |
|
| 476 | 476 | && $attempts[$max_attempts - 1] >= (time() - ($timeframe * 60))) { |
| 477 | 477 | $this->disable_account(); |
| 478 | 478 | $stat = false; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $result = $this->is_username_available($fields); |
| 60 | 60 | $accounthelper = $this->get_accounthelper(); |
| 61 | - if ( $fields['password']['switch'] |
|
| 61 | + if ($fields['password']['switch'] |
|
| 62 | 62 | && !$accounthelper->check_password_strength((string) $fields['password']['password'])) { |
| 63 | 63 | $result = ['password' => $accounthelper->errstr]; |
| 64 | 64 | } |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | $result = []; |
| 163 | 163 | |
| 164 | 164 | $accounthelper = $this->get_accounthelper(new midcom_db_person($fields["person"])); |
| 165 | - if (!$accounthelper->check_password_reuse($fields['new_password'])){ |
|
| 165 | + if (!$accounthelper->check_password_reuse($fields['new_password'])) { |
|
| 166 | 166 | $result['new_password'] = $accounthelper->errstr; |
| 167 | - } elseif (!$accounthelper->check_password_strength($fields['new_password'])){ |
|
| 167 | + } elseif (!$accounthelper->check_password_strength($fields['new_password'])) { |
|
| 168 | 168 | $result['new_password'] = $accounthelper->errstr; |
| 169 | 169 | } |
| 170 | 170 | return $result ?: true; |
@@ -162,9 +162,9 @@ |
||
| 162 | 162 | $result = []; |
| 163 | 163 | |
| 164 | 164 | $accounthelper = $this->get_accounthelper(new midcom_db_person($fields["person"])); |
| 165 | - if (!$accounthelper->check_password_reuse($fields['new_password'])){ |
|
| 165 | + if (!$accounthelper->check_password_reuse($fields['new_password'])) { |
|
| 166 | 166 | $result['new_password'] = $accounthelper->errstr; |
| 167 | - } elseif (!$accounthelper->check_password_strength($fields['new_password'])){ |
|
| 167 | + } elseif (!$accounthelper->check_password_strength($fields['new_password'])) { |
|
| 168 | 168 | $result['new_password'] = $accounthelper->errstr; |
| 169 | 169 | } |
| 170 | 170 | return $result ?: true; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $workflow = $this->get_workflow('datamanager', ['controller' => $data['controller']]); |
| 45 | 45 | $response = $workflow->run($request); |
| 46 | 46 | |
| 47 | - if ( $workflow->get_state() == 'save' |
|
| 47 | + if ($workflow->get_state() == 'save' |
|
| 48 | 48 | && $this->create_account($this->person, $data["controller"]->get_form_values())) { |
| 49 | 49 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.user'), sprintf($this->_l10n->get('person %s created'), $this->person->name)); |
| 50 | 50 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $person = new midcom_db_person($guid); |
| 78 | 78 | $accounthelper = new org_openpsa_user_accounthelper($person); |
| 79 | 79 | if ($accounthelper->welcome_email()) { |
| 80 | - midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('password reset and mail to %s sent'), $person->email )); |
|
| 80 | + midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('password reset and mail to %s sent'), $person->email)); |
|
| 81 | 81 | } else { |
| 82 | 82 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), $accounthelper->errstr, 'error'); |
| 83 | 83 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $accounthelper = new org_openpsa_user_accounthelper($this->person); |
| 134 | 134 | |
| 135 | 135 | // Update account |
| 136 | - if ( !$accounthelper->set_account($controller->get_form_values()["username"], $password) |
|
| 136 | + if (!$accounthelper->set_account($controller->get_form_values()["username"], $password) |
|
| 137 | 137 | && midcom_connection::get_error() != MGD_ERR_OK) { |
| 138 | 138 | // Failure, give a message |
| 139 | 139 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.user'), $this->_l10n->get("failed to update the user account, reason") . ': ' . $accounthelper->errstr, 'error'); |