BootstrapMFALoginForm   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFormFields() 0 11 2
1
<?php
2
3
namespace Firesphere\BootstrapMFA\Forms;
4
5
use SilverStripe\Forms\FieldList;
6
use SilverStripe\Forms\LiteralField;
7
use SilverStripe\Security\MemberAuthenticator\MemberLoginForm;
8
9
/**
10
 * Class BootstrapMFALoginForm
11
 *
12
 * @package Firesphere\BootstrapMFA\Forms
13
 */
14
class BootstrapMFALoginForm extends MemberLoginForm
15
{
16
    /**
17
     * @todo make this a lot better!
18
     * @return FieldList
19
     */
20
    public function getFormFields()
21
    {
22
        $fields = parent::getFormFields();
23
        $session = $this->controller->getRequest()->getSession();
24
        if ($session->get('tokens')) {
25
            $field = LiteralField::create('tokens', $session->get('tokens'));
26
            $fields->push($field);
27
            $session->clear('tokens');
28
        }
29
30
        return $fields;
31
    }
32
}
33