You are here

function cas_update_8005 in CAS 2.x

Same name and namespace in other branches
  1. 8 cas.install \cas_update_8005()

Set CAS login and error message defaults.

File

./cas.install, line 145
The Drupal install file.

Code

function cas_update_8005() {
  $config = \Drupal::configFactory()
    ->getEditable('cas.settings');
  $config
    ->set('login_success_message', 'You have been logged in.');

  // Instead of displaying the same error message for all users, we allow admins
  // to specify different messages for different situations. To keep the
  // previous behavior for existing sites, set all the new messages to the old
  // one.
  $previous_default_message = 'There was a problem logging in, please contact a site administrator.';
  $config
    ->set('error_handling.message_validation_failure', $previous_default_message);
  $config
    ->set('error_handling.message_no_local_account', $previous_default_message);
  $config
    ->set('error_handling.message_subscriber_denied_reg', $previous_default_message);
  $config
    ->set('error_handling.message_account_blocked', $previous_default_message);
  $config
    ->set('error_handling.message_subscriber_denied_login', $previous_default_message);
  $config
    ->set('error_handling.message_username_already_exists', $previous_default_message);
  $config
    ->save();
}