Code Duplication    Length = 12-12 lines in 2 locations

src/Authenticators/LDAPAuthenticator.php 2 locations

@@ 106-117 (lines=12) @@
103
            $username = $service->getUsernameByEmail($login);
104
105
            // No user found with this email.
106
            if (!$username) {
107
                if (Config::inst()->get(self::class, 'fallback_authenticator') === 'yes') {
108
                    if ($fallbackMember = $this->fallback_authenticate($data, $request)) {
109
                        {
110
                            return $fallbackMember;
111
                        }
112
                    }
113
                }
114
115
                $result->addError(_t('LDAPAuthenticator.INVALIDCREDENTIALS', 'Invalid credentials'));
116
                return null;
117
            }
118
        } else {
119
            $username = $login;
120
        }
@@ 124-135 (lines=12) @@
121
122
        $serviceAuthenticationResult = $service->authenticate($username, $data['Password']);
123
        $success = $serviceAuthenticationResult['success'] === true;
124
        if (!$success) {
125
            if (Config::inst()->get(self::class, 'fallback_authenticator') === 'yes') {
126
                $fallbackMember = $this->fallback_authenticate($data, $request);
127
                if ($fallbackMember) {
128
                    return $fallbackMember;
129
                }
130
            }
131
132
            $result->addError($result['message']);
133
134
            return null;
135
        }
136
137
        $data = $service->getUserByUsername($result['identity']);
138
        if (!$data) {