Code Duplication    Length = 6-7 lines in 2 locations

code/services/LDAPService.php 2 locations

@@ 154-160 (lines=7) @@
151
        $message = $messages[0]; // first message is user readable, suitable for showing on login form
152
153
        // show better errors than the defaults for various status codes returned by LDAP
154
        if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_ACCOUNT_LOCKED_OUT') !== false) {
155
            $message = _t(
156
                'LDAPService.ACCOUNTLOCKEDOUT',
157
                'Your account has been temporarily locked because of too many failed login attempts. ' .
158
                'Please try again later.'
159
            );
160
        }
161
        if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_LOGON_FAILURE') !== false) {
162
            $message = _t(
163
                'LDAPService.INVALIDCREDENTIALS',
@@ 161-166 (lines=6) @@
158
                'Please try again later.'
159
            );
160
        }
161
        if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_LOGON_FAILURE') !== false) {
162
            $message = _t(
163
                'LDAPService.INVALIDCREDENTIALS',
164
                'The provided details don\'t seem to be correct. Please try again.'
165
            );
166
        }
167
168
        return [
169
            'success' => $result->getCode() === 1,