Skip to content
Snippets Groups Projects
Commit 13ae3e14 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2569281 by iMiksu, dawehner, lauriii, alexpott, joelpittet, xjm: Change...

Issue #2569281 by iMiksu, dawehner, lauriii, alexpott, joelpittet, xjm: Change translatable string with !placeholder AccountForm to use a URL instead of a generated link and provide better context
parent 68e23f16
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -133,42 +133,30 @@ public function form(array $form, FormStateInterface $form_state) {
$form_state->set('user_pass_reset', $user_pass_reset);
}
$protected_values = array();
$current_pass_description = '';
// The user may only change their own password without their current
// password if they logged in via a one-time login link.
if (!$form_state->get('user_pass_reset')) {
$protected_values['mail'] = $form['account']['mail']['#title'];
$protected_values['pass'] = $this->t('Password');
$request_new = $this->l($this->t('Reset your password'), new Url('user.pass',
array(), array('attributes' => array('title' => $this->t('Send password reset instructions via e-mail.'))))
);
$current_pass_description = $this->t('Required if you want to change the %mail or %pass below. !request_new.',
array(
'%mail' => $protected_values['mail'],
'%pass' => $protected_values['pass'],
'!request_new' => $request_new,
)
);
}
// The user must enter their current password to change to a new one.
if ($user->id() == $account->id()) {
$form['account']['current_pass'] = array(
'#type' => 'password',
'#title' => $this->t('Current password'),
'#size' => 25,
'#access' => !empty($protected_values),
'#description' => $current_pass_description,
'#access' => !$form_state->get('user_pass_reset'),
'#weight' => -5,
// Do not let web browsers remember this password, since we are
// trying to confirm that the person submitting the form actually
// knows the current one.
'#attributes' => array('autocomplete' => 'off'),
);
$form_state->set('user', $account);
// The user may only change their own password without their current
// password if they logged in via a one-time login link.
if (!$form_state->get('user_pass_reset')) {
$form['account']['current_pass']['#description'] = $this->t('Required if you want to change the %mail or %pass below. <a href="!request_new_url" title="Send password reset instructions via e-mail.">Reset your password</a>.', array(
'%mail' => $form['account']['mail']['#title'],
'%pass' => $this->t('Password'),
'!request_new_url' => $this->url('user.pass'),
));
}
}
}
elseif (!$config->get('verify_mail') || $admin) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment