mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-10 23:01:04 +01:00
On login forms, autofocus the "username" field
Summary: Depends on D20120. Fixes T8907. I thought this needed some Javascript nonsense but Safari, Firefox and Chrome all support an `autofocus` attribute. Test Plan: Loaded login page with password auth enabled in Safari, Firefox, and Chrome; saw username field automatically gain focus. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T8907 Differential Revision: https://secure.phabricator.com/D20122
This commit is contained in:
parent
8054f7d191
commit
949afb02fd
3 changed files with 13 additions and 0 deletions
|
@ -112,6 +112,7 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider {
|
||||||
id(new AphrontFormTextControl())
|
id(new AphrontFormTextControl())
|
||||||
->setLabel(pht('LDAP Username'))
|
->setLabel(pht('LDAP Username'))
|
||||||
->setName('ldap_username')
|
->setName('ldap_username')
|
||||||
|
->setAutofocus(true)
|
||||||
->setValue($v_user)
|
->setValue($v_user)
|
||||||
->setError($e_user))
|
->setError($e_user))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
|
|
|
@ -229,6 +229,7 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider {
|
||||||
id(new AphrontFormTextControl())
|
id(new AphrontFormTextControl())
|
||||||
->setLabel(pht('Username or Email'))
|
->setLabel(pht('Username or Email'))
|
||||||
->setName('username')
|
->setName('username')
|
||||||
|
->setAutofocus(true)
|
||||||
->setValue($v_user)
|
->setValue($v_user)
|
||||||
->setError($e_user))
|
->setError($e_user))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
|
|
|
@ -5,6 +5,7 @@ final class AphrontFormTextControl extends AphrontFormControl {
|
||||||
private $disableAutocomplete;
|
private $disableAutocomplete;
|
||||||
private $sigil;
|
private $sigil;
|
||||||
private $placeholder;
|
private $placeholder;
|
||||||
|
private $autofocus;
|
||||||
|
|
||||||
public function setDisableAutocomplete($disable) {
|
public function setDisableAutocomplete($disable) {
|
||||||
$this->disableAutocomplete = $disable;
|
$this->disableAutocomplete = $disable;
|
||||||
|
@ -24,6 +25,15 @@ final class AphrontFormTextControl extends AphrontFormControl {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAutofocus($autofocus) {
|
||||||
|
$this->autofocus = $autofocus;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAutofocus() {
|
||||||
|
return $this->autofocus;
|
||||||
|
}
|
||||||
|
|
||||||
public function getSigil() {
|
public function getSigil() {
|
||||||
return $this->sigil;
|
return $this->sigil;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +59,7 @@ final class AphrontFormTextControl extends AphrontFormControl {
|
||||||
'id' => $this->getID(),
|
'id' => $this->getID(),
|
||||||
'sigil' => $this->getSigil(),
|
'sigil' => $this->getSigil(),
|
||||||
'placeholder' => $this->getPlaceholder(),
|
'placeholder' => $this->getPlaceholder(),
|
||||||
|
'autofocus' => ($this->getAutofocus() ? 'autofocus' : null),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue