Code Duplication    Length = 6-6 lines in 2 locations

src/Controller/UsersController.php 2 locations

@@ 643-648 (lines=6) @@
640
        }
641
642
        $errors = $user->getErrors();
643
        if (!empty($errors)) {
644
            $this->Flash->set(
645
                __d('nondynamic', current(array_pop($errors))),
646
                ['element' => 'error']
647
            );
648
        }
649
650
        //= unset all autofill form data
651
        foreach ($formFields as $field) {
@@ 685-690 (lines=6) @@
682
                return $this->redirect(['controller' => 'users', 'action' => 'edit', $id]);
683
            }
684
            $errors = $user->getErrors();
685
            if (!empty($errors)) {
686
                $this->Flash->set(
687
                    __d('nondynamic', current(array_pop($errors))),
688
                    ['element' => 'error']
689
                );
690
            }
691
        }
692
693
        $this->set(compact('user'));