Code Duplication    Length = 4-4 lines in 2 locations

src/Http/Api/SessionController.php 1 location

@@ 41-44 (lines=4) @@
38
39
        $setting = SysSetting::first();
40
        if (strpos($email, '@') === false) {
41
            if ($setting && isset($setting->properties) && isset($setting->properties['login_mail_domain'])) {
42
                $email = $email . '@' . $setting->properties['login_mail_domain']; 
43
            }
44
        }
45
46
        try {
47
            if (!($setting && isset($setting->properties) && isset($setting->properties['enable_login_protection']) && $setting->properties['enable_login_protection'] === 1)) {

src/Http/Api/UserController.php 1 location

@@ 50-53 (lines=4) @@
47
48
        if (strpos($email, '@') === false) {
49
            $setting = SysSetting::first();
50
            if ($setting && isset($setting->properties) && isset($setting->properties['login_mail_domain'])) {
51
                $email = $email . '@' . $setting->properties['login_mail_domain'];
52
            }
53
        }
54
55
        $user = Sentinel::authenticate([ 'email' => $email, 'password' => $password ]);
56
        if ($user) {