1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Add autocomplete=off to all non-login password forms

Summary: Fixes T5579. Modern browsers aggressively autofill credentials, but at least Firefox still behaves slightly better with this flag. Hopefully other browsers will follow suit.

Test Plan: Browsed various interfaces, verifying that login interfaces allow autocomplete while non-login interfaces do not.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5579

Differential Revision: https://secure.phabricator.com/D10253
This commit is contained in:
epriestley 2014-08-13 10:06:48 -07:00
parent a5d2460974
commit bcdadf5947
8 changed files with 29 additions and 11 deletions

View file

@ -388,6 +388,7 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider {
->setName($key)
->setLabel($label)
->setCaption($caption)
->setDisableAutocomplete(true)
->setValue($value);
break;
case 'textarea':

View file

@ -120,6 +120,7 @@ abstract class PhabricatorOAuthAuthProvider extends PhabricatorAuthProvider {
->appendChild(
id(new AphrontFormPasswordControl())
->setLabel($secret_label)
->setDisableAutocomplete(true)
->setName($key_secret)
->setValue($v_secret)
->setError($e_secret))

View file

@ -125,6 +125,7 @@ final class DiffusionSetPasswordPanel extends PhabricatorSettingsPanel {
$form
->appendChild(
id(new AphrontFormPasswordControl())
->setDisableAutocomplete(true)
->setLabel(pht('Current Password'))
->setDisabled(true)
->setValue('********************'));
@ -139,11 +140,13 @@ final class DiffusionSetPasswordPanel extends PhabricatorSettingsPanel {
$form
->appendChild(
id(new AphrontFormPasswordControl())
->setDisableAutocomplete(true)
->setName('password')
->setLabel(pht('New VCS Password'))
->setError($e_password))
->appendChild(
id(new AphrontFormPasswordControl())
->setDisableAutocomplete(true)
->setName('confirm')
->setLabel(pht('Confirm VCS Password'))
->setError($e_confirm))

View file

@ -276,6 +276,7 @@ final class PassphraseCredentialEditController extends PassphraseController {
if ($type->shouldShowPasswordField()) {
$form->appendChild(
id(new AphrontFormPasswordControl())
->setDisableAutocomplete(true)
->setName('password')
->setLabel($type->getPasswordLabel())
->setDisabled($credential_is_locked)

View file

@ -27,7 +27,8 @@ final class PassphraseCredentialTypePassword
}
public function newSecretControl() {
return new AphrontFormPasswordControl();
return id(new AphrontFormPasswordControl())
->setDisableAutocomplete(true);
}
}

View file

@ -20,6 +20,7 @@ final class PhabricatorPeopleLdapController
->setName('username'))
->appendChild(
id(new AphrontFormPasswordControl())
->setDisableAutocomplete(true)
->setLabel(pht('Password'))
->setName('password'))
->appendChild(

View file

@ -155,12 +155,14 @@ final class PhabricatorSettingsPanelPassword
$form
->appendChild(
id(new AphrontFormPasswordControl())
->setDisableAutocomplete(true)
->setLabel(pht('New Password'))
->setError($e_new)
->setName('new_pw'));
$form
->appendChild(
id(new AphrontFormPasswordControl())
->setDisableAutocomplete(true)
->setLabel(pht('Confirm Password'))
->setCaption($len_caption)
->setError($e_conf)

View file

@ -2,6 +2,13 @@
final class AphrontFormPasswordControl extends AphrontFormControl {
private $disableAutocomplete;
public function setDisableAutocomplete($disable_autocomplete) {
$this->disableAutocomplete = $disable_autocomplete;
return $this;
}
protected function getCustomControlClass() {
return 'aphront-form-control-password';
}
@ -14,6 +21,7 @@ final class AphrontFormPasswordControl extends AphrontFormControl {
'name' => $this->getName(),
'value' => $this->getValue(),
'disabled' => $this->getDisabled() ? 'disabled' : null,
'autocomplete' => ($this->disableAutocomplete ? 'off' : null),
'id' => $this->getID(),
));
}