Skip to content
Snippets Groups Projects

Issue #3398906: Do not force 'social auth' based user to change password.

1 file
+ 12
0
Compare changes
  • Side-by-side
  • Inline
+ 12
0
@@ -398,6 +398,18 @@ function password_policy_cron() {
@@ -398,6 +398,18 @@ function password_policy_cron() {
}
}
}
}
 
// Check for users logged in via 'social_auth'.
 
if (\Drupal::moduleHandler()->moduleExists('social_auth') && !empty($valid_list)) {
 
$social_auth_query = \Drupal::database()->select('social_auth');
 
$social_auth_query->innerJoin('users_field_data', 'users_field_data', 'users_field_data.uid = social_auth.user_id');
 
$social_auth_query->fields('social_auth', ['user_id']);
 
$social_auth_query->where('social_auth.user_id IN ( :uids[] )', [':uids[]' => $valid_list]);
 
$social_auth_user_ids = $social_auth_query->execute()->fetchCol();
 
// Remove the socially logged in users from the list to avoid setting
 
// the field_password_expiration to them.
 
$valid_list = array_diff($valid_list, $social_auth_user_ids);
 
}
 
// Load User Objects.
// Load User Objects.
$users = \Drupal::entityTypeManager()
$users = \Drupal::entityTypeManager()
->getStorage('user')
->getStorage('user')
Loading