Code Duplication    Length = 25-30 lines in 2 locations

app/src/Users/UsersController.php 2 locations

@@ 303-332 (lines=30) @@
300
            $this->redirectTo($this->url->create('users/login'));
301
        }
302
    }
303
    private function createAddUserForm()
304
    {
305
        return $this->di->form->create([], [
306
            'name' => [
307
                'type'        => 'text',
308
                'label'       => 'Name of person:',
309
                'required'    => true,
310
                'validation'  => ['not_empty'],
311
            ],
312
            'acronym' => [
313
                'type'        => 'text',
314
                'label'       => 'Acronym of person:',
315
                'required'    => true,
316
                'validation'  => ['not_empty'],
317
            ],
318
            'email' => [
319
                'type'        => 'text',
320
                'required'    => true,
321
                'validation'  => ['not_empty', 'email_adress'],
322
            ],
323
            'submit' => [
324
                'type'      => 'submit',
325
                'callback'  => [$this, 'callbackSubmitAddUser'],
326
            ],
327
            // 'submit-fail' => [
328
            //     'type'      => 'submit',
329
            //     'callback'  => [$this, 'callbackSubmitFailAddUser'],
330
            // ],
331
        ]);
332
    }
333
    /**
334
     * Callback for submit-button.
335
     *
@@ 670-694 (lines=25) @@
667
            'content' => $form->getHTML()
668
        ]);
669
    }
670
    private function createLoginForm()
671
    {
672
        return $this->di->form->create([], [
673
            'user' => [
674
                'type'        => 'text',
675
                'label'       => 'Användarnamn:',
676
                'required'    => true,
677
                'validation'  => ['not_empty'],
678
            ],
679
            'password' => [
680
                'type'        => 'password',
681
                'label'       => 'Lösenord:',
682
                'required'    => true,
683
                'validation'  => ['not_empty'],
684
            ],
685
            'submit' => [
686
                'type'      => 'submit',
687
                'callback'  => [$this, 'callbackSubmitLogin'],
688
            ],
689
            'submit-fail' => [
690
                'type'      => 'submit',
691
                'callback'  => [$this, 'callbackSubmitFailLogin'],
692
            ],
693
        ]);
694
    }
695
    /**
696
     * Callback for submit-button.
697
     *