Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use meaningful values for the "autocomplete" attributes #2432

Merged
merged 2 commits into from Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -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" autocomplete="new-password" name="%s" id="ctrl_%s" class="tl_text tl_password%s" value="%s"%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" autocomplete="new-password" name="%s_confirm" id="ctrl_%s_confirm" class="tl_text tl_password confirm%s" value="%s"%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