protected function createForm(Framework $framework, WebRequest $request, Response $response)
    {
        // Create the form
        $form = new Form('login', $request->getFullRoute('login'), 'post');
        
        // Add the user data group
        $errorBox = new ErrorBox(
            'login-errors',
            1
        );
        $form->addPart($errorBox);
        
        $origin = '';
        if ($request->hasParam('_origin')) {
            $origin = $request->getParam('_origin');
        }
        
        $helpText = '';
        if ($this->getSetting('accesscontrol.allowRenewPassword')) {
            $helpText = $this->translate('Lost your password? <a href="%link%">Renew it here.</a>', '\\Zepi\\Web\\AccessControl', array(
                'link' => $request->getFullRoute('request-new-password')
            ));
        }
        
        // Add the user data group
        $group = new Group(
            'user-data',
            $this->translate('User data', '\\Zepi\\Web\\AccessControl'),
            array(
                new Text(
                    'username',
                    $this->translate('Username', '\\Zepi\\Web\\AccessControl'),
                    true
                ),
                new Password(
                    'password',
                    $this->translate('Password', '\\Zepi\\Web\\AccessControl'),
                    true,
                    '',
                    $helpText
                ),
                new Hidden(
                    'origin',
                    $origin
                )
            ),
            10
        );
        $form->addPart($group);
        
        // Add the submit button
        $buttonGroup = new ButtonGroup(
            'buttons',
            array(
                new Submit(
                    'submit',
                    $this->translate('Login', '\\Zepi\\Web\\AccessControl')
                )
            ),
            100
        );
        $form->addPart($buttonGroup);
        
        return $form;
    }