Page MenuHomePhabricator

D16323.id39248.diff
No OneTemporary

D16323.id39248.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1626,6 +1626,7 @@
'PHUIFormIconSetControl' => 'view/form/control/PHUIFormIconSetControl.php',
'PHUIFormInsetView' => 'view/form/PHUIFormInsetView.php',
'PHUIFormLayoutView' => 'view/form/PHUIFormLayoutView.php',
+ 'PHUIFormNumberControl' => 'view/form/control/PHUIFormNumberControl.php',
'PHUIHandleListView' => 'applications/phid/view/PHUIHandleListView.php',
'PHUIHandleTagListView' => 'applications/phid/view/PHUIHandleTagListView.php',
'PHUIHandleView' => 'applications/phid/view/PHUIHandleView.php',
@@ -6185,6 +6186,7 @@
'PHUIFormIconSetControl' => 'AphrontFormControl',
'PHUIFormInsetView' => 'AphrontView',
'PHUIFormLayoutView' => 'AphrontView',
+ 'PHUIFormNumberControl' => 'AphrontFormControl',
'PHUIHandleListView' => 'AphrontTagView',
'PHUIHandleTagListView' => 'AphrontTagView',
'PHUIHandleView' => 'AphrontView',
diff --git a/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php b/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php
--- a/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php
+++ b/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php
@@ -132,7 +132,7 @@
'the authenticator correctly:'));
$form->appendChild(
- id(new AphrontFormTextControl())
+ id(new PHUIFormNumberControl())
->setLabel(pht('TOTP Code'))
->setName('totpcode')
->setValue($code)
diff --git a/src/view/form/control/PHUIFormNumberControl.php b/src/view/form/control/PHUIFormNumberControl.php
new file mode 100644
--- /dev/null
+++ b/src/view/form/control/PHUIFormNumberControl.php
@@ -0,0 +1,22 @@
+<?php
+
+final class PHUIFormNumberControl extends AphrontFormControl {
+
+ protected function getCustomControlClass() {
+ return 'phui-form-number';
+ }
+
+ protected function renderInput() {
+ return javelin_tag(
+ 'input',
+ array(
+ 'type' => 'text',
+ 'pattern' => '\d*',
+ 'name' => $this->getName(),
+ 'value' => $this->getValue(),
+ 'disabled' => $this->getDisabled() ? 'disabled' : null,
+ 'id' => $this->getID(),
+ ));
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 26, 5:47 AM (6 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7723357
Default Alt Text
D16323.id39248.diff (2 KB)

Event Timeline