Page MenuHomePhabricator

D19722.id47121.diff
No OneTemporary

D19722.id47121.diff

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
@@ -154,6 +154,7 @@
id(new PHUIFormNumberControl())
->setName($this->getParameterName($config, 'totpcode'))
->setLabel(pht('App Code'))
+ ->setDisableAutocomplete(true)
->setCaption(pht('Factor Name: %s', $config->getFactorName()))
->setValue(idx($validation_result, 'value'))
->setError(idx($validation_result, 'error', true)));
diff --git a/src/view/form/control/PHUIFormNumberControl.php b/src/view/form/control/PHUIFormNumberControl.php
--- a/src/view/form/control/PHUIFormNumberControl.php
+++ b/src/view/form/control/PHUIFormNumberControl.php
@@ -2,11 +2,28 @@
final class PHUIFormNumberControl extends AphrontFormControl {
+ private $disableAutocomplete;
+
+ public function setDisableAutocomplete($disable_autocomplete) {
+ $this->disableAutocomplete = $disable_autocomplete;
+ return $this;
+ }
+
+ public function getDisableAutocomplete() {
+ return $this->disableAutocomplete;
+ }
+
protected function getCustomControlClass() {
return 'phui-form-number';
}
protected function renderInput() {
+ if ($this->getDisableAutocomplete()) {
+ $autocomplete = 'off';
+ } else {
+ $autocomplete = null;
+ }
+
return javelin_tag(
'input',
array(
@@ -15,6 +32,7 @@
'name' => $this->getName(),
'value' => $this->getValue(),
'disabled' => $this->getDisabled() ? 'disabled' : null,
+ 'autocomplete' => $autocomplete,
'id' => $this->getID(),
));
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 2:06 PM (12 m, 48 s)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7074774
Default Alt Text
D19722.id47121.diff (1 KB)

Event Timeline