Skip to content

Commit

Permalink
Add autocompletion for password reset
Browse files Browse the repository at this point in the history
Using autocomplete="current-password" and autocomplete="new-password"
will help browser with integrated password managers to generate safe
password for the users.

See https://developer.apple.com/documentation/security/password_autofill/enabling_password_autofill_on_an_html_input_element
and https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/password#allowing_autocomplete.

Also unify autocapitalize="none" autocorrect="off" behavior in a few
other places for password input fields.

Close #27885

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
  • Loading branch information
CarlSchwan committed Jul 13, 2021
1 parent a8aeaa6 commit 7344b2a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
<label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label>
<input type="password" id="pass1" name="oldpassword"
placeholder="<?php p($l->t('Current password'));?>"
autocomplete="off" autocapitalize="none" autocorrect="off" />
autocomplete="current-password" autocapitalize="none" autocorrect="off" />

<div class="personal-show-container">
<label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label>
<input type="password" id="pass2" name="newpassword"
placeholder="<?php p($l->t('New password')); ?>"
data-typetoggle="#personal-show"
autocomplete="off" autocapitalize="none" autocorrect="off" />
autocomplete="new-password" autocapitalize="none" autocorrect="off" />
<input type="checkbox" id="personal-show" class="hidden-visually" name="show" /><label for="personal-show" class="personal-show-label"></label>
</div>

Expand Down
5 changes: 4 additions & 1 deletion core/src/components/login/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
type="text"
name="user"
autocapitalize="off"
autocorrect="off"
:autocomplete="autoCompleteAllowed ? 'on' : 'off'"
:placeholder="t('core', 'Username or email')"
:aria-label="t('core', 'Username or email')"
Expand All @@ -75,7 +76,9 @@
:type="passwordInputType"
class="password-with-toggle"
name="password"
:autocomplete="autoCompleteAllowed ? 'on' : 'off'"
autocorrect="off"
autocapitalize="none"
:autocomplete="autoCompleteAllowed ? 'current-password' : 'off'"
:placeholder="t('core', 'Password')"
:aria-label="t('core', 'Password')"
required>
Expand Down
3 changes: 3 additions & 0 deletions core/src/components/login/UpdatePassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
v-model="password"
type="password"
name="password"
autocomplete="current-password"
autocapitalize="none"
autocorrect="off"
required
:placeholder="t('core', 'New password')">
</p>
Expand Down

0 comments on commit 7344b2a

Please sign in to comment.