Code Duplication    Length = 10-10 lines in 2 locations

plugins/User/src/Controller/GatewayController.php 2 locations

@@ 48-57 (lines=10) @@
45
                ->orWhere(['Users.email' => $this->request->data['username']])
46
                ->first();
47
48
            if ($user) {
49
                $emailSent = NotificationManager::passwordRequest($user)->send();
50
                if ($emailSent) {
51
                    $this->Flash->success(__d('user', 'Further instructions have been sent to your e-mail address.'));
52
                } else {
53
                    $this->Flash->warning(__d('user', 'Instructions could not been sent to your e-mail address, please try again later.'));
54
                }
55
            } else {
56
                $this->Flash->danger(__d('user', 'Sorry, "{0}" is not recognized as a user name or an e-mail address.', $this->request->data['username']));
57
            }
58
        }
59
60
        $this->title(__d('user', 'Password Recovery'));
@@ 114-123 (lines=10) @@
111
            $this->redirect($this->referer());
112
        }
113
114
        if ($user && $code == $user->cancel_code) {
115
            if ($this->Users->delete($user)) {
116
                NotificationManager::canceled($user)->send();
117
                $this->Flash->success(__d('user', 'Account successfully canceled'));
118
            } else {
119
                $this->Flash->danger(__d('user', 'Account could not be canceled due to an internal error, please try again later.'));
120
            }
121
        } else {
122
            $this->Flash->warning(__d('user', 'Not user was found, invalid cancellation URL.'));
123
        }
124
125
        $this->title(__d('user', 'Account Cancellation'));
126
        $this->redirect($this->referer());