You are here

function social_auth_update_8002 in Social Auth 8

Implements hook_update_N().

PathValidator requires path to begin with '/', '?', or '#'.

This update makes sure that if the post login value was "user" (the previous default value), it is changed to "/user". This also changes the configuration key post_login_path to post_login.

File

./social_auth.install, line 30
Install, update and uninstall functions for Social Auth.

Code

function social_auth_update_8002(&$sandbox) {
  $config = \Drupal::configFactory()
    ->getEditable('social_auth.settings');
  $post_login = $config
    ->get('post_login_path');
  if ($post_login == 'user') {
    $config
      ->set('post_login', '/user');
  }
  else {
    $config
      ->set('post_login', $post_login);
  }
  $config
    ->save();
}