Code Duplication    Length = 11-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->fallbackAuthenticate($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
        }
@@ 123-133 (lines=11) @@
120
        }
121
        $serviceAuthenticationResult = $service->authenticate($username, $data['Password']);
122
        $success = $serviceAuthenticationResult['success'] === true;
123
        if (!$success) {
124
            if (Config::inst()->get(self::class, 'fallback_authenticator') === 'yes') {
125
                if ($fallbackMember = $this->fallbackAuthenticate($data, $request)) {
126
                    return $fallbackMember;
127
                }
128
            }
129
130
            $result->addError($serviceAuthenticationResult['message']);
131
132
            return null;
133
        }
134
        $data = $service->getUserByUsername($serviceAuthenticationResult['identity']);
135
        if (!$data) {
136
            $result->addError(