Issue #3184484 by allaprishchepa, larisse, Mistrae: Error: Call to a member...
Issue #3184484 by allaprishchepa, larisse, Mistrae: Error: Call to a member function id() on null in force_password_change_form_alter() (line 106 of modules/contrib/force_password_change/force_password_change.module)
$description=t('Users will be required to change their password upon their next login.');
}
else{
else
{
$description=t('Users who are not signed in will be required to change their password immediately upon login. Users who are currently signed in will be required to change their password upon their next page click, and after changing their password will be redirected back to the page they were attempting to access.');
}
$form['force_password_change']=
[
$form['force_password_change']=array
(
'#type'=>'checkbox',
'#title'=>t('Force users in this role to change their password'),
'#description'=>$description.'<br />'.t('Note: When you return to this page, this box will be unchecked. This is because this setting is a trigger, not a persistant state.'),
];
);
// Add a custom submit function that forces all users in
// the role to change their password.
// Add a custom submit function that forces all users in the role to change their password
$description=t('If this box is checked, the user will be forced to change their password upon their next login.');
}
else{
else
{
$description=t('If this box is checked, the user will be forced to change their password. If the user is signed in, they will be forced to change their password on their next page load. If they are not signed in, they will be forced to change their password the next time they log in.');
$items[]=t('User has a pending forced password change: @pending',['@pending'=>(\Drupal::service('user.data')->get('force_password_change',$account->id(),'pending_force')?t('Yes'):t('No'))]);
$items[]=t('User has a pending forced password change: @pending',['@pending'=>(\Drupal::service('user.data')->get('force_password_change',$account->id(),'force_password_change')?t('Yes'):t('No'))]);
$items[]=t('User was last forced to change their password on: @last_force',['@last_force'=>$last_force]);
$items[]=t("User's password was last changed on: @last_change",['@last_change'=>$last_change_time?\Drupal::service('date.formatter')->format($last_change_time,'short'):t('Never')]);
// Display the user's password change stats for the administrator.
// Display the user's password change stats for the administrator
$use_form['password']['password_stats']=[
'header'=>[
'#prefix'=>'<p><strong>',
@@ -137,7 +152,8 @@ function force_password_change_form_alter(&$form, FormStateInterface $form_state
$protected_values=[];
// The user may only change their own password without their current
// password if they logged in via a one-time login link.
$url=Url::fromRoute('user.pass',[],['attributes'=>['title'=>t('Request new password via e-mail.')]]);
@@ -146,29 +162,31 @@ function force_password_change_form_alter(&$form, FormStateInterface $form_state
$form['account']['current_pass']['#description']=t('Enter your current password to change the %mail or %pass. If you do not know your current password, you can @request_new.',['%mail'=>$protected_values['mail'],'%pass'=>$protected_values['pass'],'@request_new'=>$request_new]);
}
// Set a flag indicating whether the user is being
// force to change their password.
$form['pending_force_password_change']=
[
// Set a flag indicating whether the user is being force to change their password