You are here

public static function handler::reset_mo_config in OAuth2 Login 8

Reset Saved Configuration

2 calls to handler::reset_mo_config()
miniorange_oauth_clientController::reset_mo_config in src/Controller/miniorange_oauth_clientController.php
oauth2_loginController::reset_mo_config in src/Controller/oauth2_loginController.php

File

src/handler.php, line 162

Class

handler

Namespace

Drupal\oauth2_login

Code

public static function reset_mo_config() {
  global $base_url;
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_oauth_client_app')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_oauth_client_appval')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_auth_client_client_id')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_auth_client_app_name')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_auth_client_display_name')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_auth_client_client_secret')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_auth_client_scope')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_auth_client_authorize_endpoint')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_auth_client_access_token_ep')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_oauth_client_email_attr_val')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_oauth_client_name_attr_val')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_auth_client_user_info_ep')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_auth_client_stat')
    ->save();
  \Drupal::configFactory()
    ->getEditable('oauth2_login.settings')
    ->clear('miniorange_oauth_client_attr_list_from_server')
    ->save();
  \Drupal::messenger()
    ->addMessage("Your Configurations have been deleted successfully");
  if (!empty(\Drupal::config('oauth2_login.settings')
    ->get('miniorange_oauth_client_base_url'))) {
    $baseUrlValue = \Drupal::config('oauth2_login.settings')
      ->get('miniorange_oauth_client_base_url');
  }
  else {
    $baseUrlValue = $base_url;
  }
  $response = new RedirectResponse($baseUrlValue . "/admin/config/people/oauth2_login/config_clc");
  $response
    ->send();
  exit;
}