Code Duplication    Length = 5-5 lines in 2 locations

Controller/UsersController.php 2 locations

@@ 150-154 (lines=5) @@
147
                }
148
149
                try {
150
                    if (isset($params['sendPassword']) && $params['sendPassword'] != '') {
151
                        $this->getPasswordManager()->encodeAndSetPasswordAndThenEmailIt($user, $plainPassword);
152
                    } else {
153
                        $this->getPasswordManager()->encodeAndSetPassword($user, $plainPassword);
154
                    }
155
                } catch (BadPasswordException $e) {
156
                    throw new BadPasswordException($e->getErrors()[0], null, $e);
157
                }
@@ 251-255 (lines=5) @@
248
                    try {
249
                        // We are force to do it here because we have no access to validation in
250
                        // "map_data_on_update"
251
                        if (isset($params['sendPassword']) && $params['sendPassword'] != '') {
252
                            $this->getPasswordManager()->encodeAndSetPasswordAndThenEmailIt($user, $params['plainPassword']);
253
                        } else {
254
                            $this->getPasswordManager()->encodeAndSetPassword($user, $params['plainPassword']);
255
                        }
256
                    } catch (BadPasswordException $e) {
257
                        $result->addFieldError('plainPassword', $e->getErrors()[0]);
258
                    }