1<?php
2
3namespace dokuwiki\plugin\twofactor;
4
5use dokuwiki\Form\InputElement;
6
7/**
8 * A Form field for OTP codes
9 *
10 * Providers should use this field when asking for the code
11 */
12class OtpField extends InputElement
13{
14
15    /** @inheritdoc */
16    public function __construct($name, $label = '')
17    {
18        if ($label === '') {
19            $label = (Manager::getInstance())->getLang('otp');
20        }
21        parent::__construct('password', $name, $label);
22
23        $this->attr('autofocus', 'on');
24        $this->attr('autocomplete', 'one-time-code');
25        $this->attr('inputmode', 'numeric');
26        $this->useInput(false);
27    }
28
29}
30