Skip to content

Commit

Permalink
Use meaningful values for the "autocomplete" attributes (see #2432)
Browse files Browse the repository at this point in the history
Description
-----------

Implements #1669

Commits
-------

8be1dd9 Use meaningful values for the "autocomplete" attributes
50e6924 Found more occurrences
  • Loading branch information
leofeyer committed Oct 16, 2020
1 parent e3ed620 commit 95ed373
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion core-bundle/src/Resources/contao/dca/tl_member.php
Expand Up @@ -302,7 +302,7 @@
'sorting' => true,
'flag' => 1,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'unique'=>true, 'rgxp'=>'extnd', 'nospace'=>true, 'maxlength'=>64, 'feEditable'=>true, 'feViewable'=>true, 'feGroup'=>'login', 'tl_class'=>'w50'),
'eval' => array('mandatory'=>true, 'unique'=>true, 'rgxp'=>'extnd', 'nospace'=>true, 'maxlength'=>64, 'feEditable'=>true, 'feViewable'=>true, 'feGroup'=>'login', 'tl_class'=>'w50', 'autocapitalize'=>'off', 'autocomplete'=>'username'),
'sql' => 'varchar(64) BINARY NULL'
),
'password' => array
Expand Down
2 changes: 1 addition & 1 deletion core-bundle/src/Resources/contao/dca/tl_user.php
Expand Up @@ -149,7 +149,7 @@
'sorting' => true,
'flag' => 1,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'rgxp'=>'extnd', 'nospace'=>true, 'unique'=>true, 'maxlength'=>64, 'tl_class'=>'w50'),
'eval' => array('mandatory'=>true, 'rgxp'=>'extnd', 'nospace'=>true, 'unique'=>true, 'maxlength'=>64, 'tl_class'=>'w50', 'autocapitalize'=>'off', 'autocomplete'=>'username'),
'sql' => "varchar(64) BINARY NULL"
),
'name' => array
Expand Down
4 changes: 2 additions & 2 deletions core-bundle/src/Resources/contao/forms/FormPassword.php
Expand Up @@ -167,7 +167,7 @@ public function parse($arrAttributes=null)
public function generate()
{
return sprintf(
'<input type="password" name="%s" id="ctrl_%s" class="text password%s" value=""%s%s',
'<input type="password" name="%s" id="ctrl_%s" class="text password%s" value="" autocomplete="new-password"%s%s',
$this->strName,
$this->strId,
($this->strClass ? ' ' . $this->strClass : ''),
Expand Down Expand Up @@ -201,7 +201,7 @@ public function generateConfirmationLabel()
public function generateConfirmation()
{
return sprintf(
'<input type="password" name="%s_confirm" id="ctrl_%s_confirm" class="text password confirm%s" value=""%s%s',
'<input type="password" name="%s_confirm" id="ctrl_%s_confirm" class="text password confirm%s" value="" autocomplete="new-password"%s%s',
$this->strName,
$this->strId,
($this->strClass ? ' ' . $this->strClass : ''),
Expand Down
Expand Up @@ -76,7 +76,7 @@ protected function compile()
'name' => 'oldpassword',
'label' => &$GLOBALS['TL_LANG']['MSC']['oldPassword'],
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'preserveTags'=>true, 'hideInput'=>true),
'eval' => array('mandatory'=>true, 'preserveTags'=>true, 'hideInput'=>true, 'autocomplete'=>'current-password'),
);

// New password widget
Expand Down
Expand Up @@ -50,11 +50,11 @@
<h1><?= $this->headline ?></h1>
<div class="widget widget-text">
<label for="username"><?= $this->username ?></label>
<input type="text" name="username" id="username" class="tl_text" value="<?= $this->curUsername ?>" autocapitalize="off" placeholder="<?= $this->username ?>" required>
<input type="text" name="username" id="username" class="tl_text" value="<?= $this->curUsername ?>" autocapitalize="off" autocomplete="username" placeholder="<?= $this->username ?>" required>
</div>
<div class="widget widget-password">
<label for="password"><?= $this->password ?></label>
<input type="password" name="password" id="password" class="tl_text" value="" placeholder="<?= $this->password ?>" required>
<input type="password" name="password" id="password" class="tl_text" value="" autocomplete="current-password" placeholder="<?= $this->password ?>" required>
</div>
<div class="submit_container cf">
<button type="submit" name="login" id="login" class="tl_submit"><?= $this->loginButton ?></button>
Expand Down
Expand Up @@ -50,7 +50,7 @@
<h1><?= $this->headline ?></h1>
<div class="widget widget-text">
<label for="verify"><?= $this->authCode ?></label>
<input type="text" name="verify" id="verify" class="tl_text" value="" autocapitalize="off" autocomplete="off" placeholder="<?= $this->authCode ?>" required>
<input type="text" name="verify" id="verify" class="tl_text" value="" autocapitalize="off" autocomplete="one-time-code" placeholder="<?= $this->authCode ?>" required>
</div>
<div class="widget widget-checkbox">
<input type="checkbox" name="trusted" id="trusted" class="tl_checkbox" value="1">
Expand Down
Expand Up @@ -42,11 +42,11 @@
<p><?= $this->explain ?></p>
<div class="widget">
<label for="password"><?= $this->password ?></label>
<input type="password" name="password" id="password" class="tl_text" value="" placeholder="<?= $this->password ?>" required>
<input type="password" name="password" id="password" class="tl_text" value="" autocomplete="new-password" placeholder="<?= $this->password ?>" required>
</div>
<div class="widget">
<label for="confirm"><?= $this->confirm ?></label>
<input type="password" name="confirm" id="confirm" class="tl_text" value="" placeholder="<?= $this->confirm ?>" required>
<input type="password" name="confirm" id="confirm" class="tl_text" value="" autocomplete="new-password" placeholder="<?= $this->confirm ?>" required>
</div>
<div class="submit_container cf">
<button type="submit" name="login" id="login" class="tl_submit"><?= $this->submitButton ?></button>
Expand Down
Expand Up @@ -22,7 +22,7 @@
</div>
<div class="widget w50 clr">
<h3><label for="verify"<?php if ($this->error): ?> class="error"<?php endif; ?>><?= $this->trans('MSC.twoFactorVerification') ?></label></h3>
<input type="text" name="verify" id="verify" class="tl_text<?php if ($this->error): ?> error<?php endif; ?>" value="" autocapitalize="off" autocomplete="off" required>
<input type="text" name="verify" id="verify" class="tl_text<?php if ($this->error): ?> error<?php endif; ?>" value="" autocapitalize="off" autocomplete="one-time-code" required>
<p class="<?= $this->error ? 'tl_error' : 'tl_help' ?> tl_tip"><?= $this->trans('MSC.twoFactorVerificationHelp') ?></p>
</div>
<div class="submit_container cf">
Expand Down
Expand Up @@ -17,7 +17,7 @@
<p class="error"><?= $this->getErrorAsString() ?></p>
<?php endif; ?>

<input type="password" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" class="text password<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>" value=""<?= $this->getAttributes() ?>>
<input type="password" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" class="text password<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>" value="" autocomplete="new-password"<?= $this->getAttributes() ?>>
<?php $this->endblock(); ?>

<?php $this->block('label2'); ?>
Expand All @@ -33,5 +33,5 @@
<?php $this->endblock(); ?>

<?php $this->block('field2'); ?>
<input type="password" name="<?= $this->name ?>_confirm" id="ctrl_<?= $this->id ?>_confirm" class="text password<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>" value=""<?= $this->getAttributes() ?>>
<input type="password" name="<?= $this->name ?>_confirm" id="ctrl_<?= $this->id ?>_confirm" class="text password<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>" value="" autocomplete="new-password"<?= $this->getAttributes() ?>>
<?php $this->endblock(); ?>
Expand Up @@ -21,7 +21,7 @@
<h3><?= $this->twoFactorAuthentication ?></h3>
<div class="widget widget-text">
<label for="verify"><?= $this->authCode ?></label>
<input type="text" name="verify" id="verify" class="text" value="" autocapitalize="off" autocomplete="off" required>
<input type="text" name="verify" id="verify" class="text" value="" autocapitalize="off" autocomplete="one-time-code" required>
</div>
<div class="widget widget-checkbox">
<input type="checkbox" name="trusted" id="trusted" class="tl_checkbox" value="1">
Expand All @@ -30,11 +30,11 @@
<?php else: ?>
<div class="widget widget-text">
<label for="username"><?= $this->username ?></label>
<input type="text" name="username" id="username" class="text" value="<?= $this->value ?>" required>
<input type="text" name="username" id="username" class="text" value="<?= $this->value ?>" autocapitalize="off" autocomplete="username" required>
</div>
<div class="widget widget-password">
<label for="password"><?= $this->password ?></label>
<input type="password" name="password" id="password" class="text password" value="" required>
<input type="password" name="password" id="password" class="text password" value="" autocomplete="current-password" required>
</div>
<?php if ($this->autologin): ?>
<div class="widget widget-checkbox">
Expand Down
Expand Up @@ -24,7 +24,7 @@
</div>
<div class="widget widget-text">
<label for="verify"><?= $this->trans('MSC.twoFactorVerification') ?></label>
<input type="text" name="verify" id="verify" class="text" value="" autocapitalize="off" autocomplete="off" required>
<input type="text" name="verify" id="verify" class="text" value="" autocapitalize="off" autocomplete="one-time-code" required>
<p class="help"><?= $this->trans('MSC.twoFactorVerificationHelp') ?></p>
</div>
<div class="submit_container">
Expand Down
4 changes: 2 additions & 2 deletions core-bundle/src/Resources/contao/widgets/Password.php
Expand Up @@ -150,7 +150,7 @@ protected function validator($varInput)
public function generate()
{
return sprintf(
'<input type="password" autocomplete="off" name="%s" id="ctrl_%s" class="tl_text tl_password%s" value="%s"%s onfocus="Backend.getScrollOffset()">%s%s',
'<input type="password" name="%s" id="ctrl_%s" class="tl_text tl_password%s" value="%s" autocomplete="new-password"%s onfocus="Backend.getScrollOffset()">%s%s',
$this->strName,
$this->strId,
($this->strClass ? ' ' . $this->strClass : ''),
Expand Down Expand Up @@ -186,7 +186,7 @@ public function generateConfirmationLabel()
public function generateConfirmation()
{
return sprintf(
'<input type="password" autocomplete="off" name="%s_confirm" id="ctrl_%s_confirm" class="tl_text tl_password confirm%s" value="%s"%s onfocus="Backend.getScrollOffset()">%s',
'<input type="password" name="%s_confirm" id="ctrl_%s_confirm" class="tl_text tl_password confirm%s" value="%s" autocomplete="new-password"%s onfocus="Backend.getScrollOffset()">%s',
$this->strName,
$this->strId,
($this->strClass ? ' ' . $this->strClass : ''),
Expand Down
Expand Up @@ -10,7 +10,7 @@
{% if canSwitchUser %}
<div>
<label for="ctrl_user">{{ 'MSC.feUser'|trans }}:</label>
<input type="text" name="user" id="ctrl_user" list="userlist" class="tl_text user" placeholder="{{ 'MSC.username'|trans }}" value="{{ user }}" autocomplete="off">
<input type="text" name="user" id="ctrl_user" list="userlist" class="tl_text user" placeholder="{{ 'MSC.username'|trans }}" value="{{ user }}" autocomplete="username">
<datalist id="userlist"></datalist>
</div>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion installation-bundle/src/Resources/views/login.html.twig
Expand Up @@ -14,7 +14,7 @@
<input type="hidden" name="FORM_SUBMIT" value="tl_login">
<input type="hidden" name="REQUEST_TOKEN" value="{{ request_token }}">
<h4><label for="password">{{ 'password'|trans }}</label></h4>
<input type="password" name="password" id="password" autocomplete="off" class="tl_text" value="">
<input type="password" name="password" id="password" class="tl_text" value="" autocomplete="current-password">
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
Expand Down
4 changes: 2 additions & 2 deletions installation-bundle/src/Resources/views/password.html.twig
Expand Up @@ -13,9 +13,9 @@
<input type="hidden" name="FORM_SUBMIT" value="tl_password">
<input type="hidden" name="REQUEST_TOKEN" value="{{ request_token }}">
<h4><label for="password">{{ 'password'|trans }}</label></h4>
<input type="password" name="password" id="password" autocomplete="off" class="tl_text" value="">
<input type="password" name="password" id="password" class="tl_text" value="" autocomplete="new-password">
<h4><label for="confirmation">{{ 'confirmation'|trans }}</label></h4>
<input type="password" name="confirmation" id="confirmation" autocomplete="off" class="tl_text" value="">
<input type="password" name="confirmation" id="confirmation" class="tl_text" value="" autocomplete="new-password">
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
Expand Down

0 comments on commit 95ed373

Please sign in to comment.