@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a numeric input control for TOTP codes

Summary:
Fixes T11365. I tested these variants:

- `<input type="number" />`
- `<input type="text" pattern="\d*" />`

Of these, this one (using `pattern`) appears to have the best behavior: it shows the correct keyboard on iOS mobile and does nothing on desktops.

Using `type="number"` causes unwanted sub-controls to appear in desktop Safari, and a numbers + symbols keyboard to appear on iOS (presumably so users can type "." and "-" and maybe ",").

Test Plan: Tested variants in desktop browsers and iOS simulator, see here and T11365 for discussion.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11365

Differential Revision: https://secure.phabricator.com/D16323

+25 -1
+2
src/__phutil_library_map__.php
··· 1626 1626 'PHUIFormIconSetControl' => 'view/form/control/PHUIFormIconSetControl.php', 1627 1627 'PHUIFormInsetView' => 'view/form/PHUIFormInsetView.php', 1628 1628 'PHUIFormLayoutView' => 'view/form/PHUIFormLayoutView.php', 1629 + 'PHUIFormNumberControl' => 'view/form/control/PHUIFormNumberControl.php', 1629 1630 'PHUIHandleListView' => 'applications/phid/view/PHUIHandleListView.php', 1630 1631 'PHUIHandleTagListView' => 'applications/phid/view/PHUIHandleTagListView.php', 1631 1632 'PHUIHandleView' => 'applications/phid/view/PHUIHandleView.php', ··· 6185 6186 'PHUIFormIconSetControl' => 'AphrontFormControl', 6186 6187 'PHUIFormInsetView' => 'AphrontView', 6187 6188 'PHUIFormLayoutView' => 'AphrontView', 6189 + 'PHUIFormNumberControl' => 'AphrontFormControl', 6188 6190 'PHUIHandleListView' => 'AphrontTagView', 6189 6191 'PHUIHandleTagListView' => 'AphrontTagView', 6190 6192 'PHUIHandleView' => 'AphrontView',
+1 -1
src/applications/auth/factor/PhabricatorTOTPAuthFactor.php
··· 132 132 'the authenticator correctly:')); 133 133 134 134 $form->appendChild( 135 - id(new AphrontFormTextControl()) 135 + id(new PHUIFormNumberControl()) 136 136 ->setLabel(pht('TOTP Code')) 137 137 ->setName('totpcode') 138 138 ->setValue($code)
+22
src/view/form/control/PHUIFormNumberControl.php
··· 1 + <?php 2 + 3 + final class PHUIFormNumberControl extends AphrontFormControl { 4 + 5 + protected function getCustomControlClass() { 6 + return 'phui-form-number'; 7 + } 8 + 9 + protected function renderInput() { 10 + return javelin_tag( 11 + 'input', 12 + array( 13 + 'type' => 'text', 14 + 'pattern' => '\d*', 15 + 'name' => $this->getName(), 16 + 'value' => $this->getValue(), 17 + 'disabled' => $this->getDisabled() ? 'disabled' : null, 18 + 'id' => $this->getID(), 19 + )); 20 + } 21 + 22 + }