Commit f929746f authored by Fabian de Rijk's avatar Fabian de Rijk
Browse files

Issue #3196456 by al_trottier: RuntimeException in LoginCallbackController

parent 7229da4e
Loading
Loading
Loading
Loading
+5 −17
Original line number Diff line number Diff line
@@ -4,13 +4,13 @@ namespace Drupal\o365_sso\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Routing\TrustedRedirectResponse;
use Drupal\externalauth\ExternalAuth;
use Drupal\o365\AuthenticationService;
use Drupal\o365\GraphService;
use Drupal\o365\O365ConnectorInterface;
use Drupal\user\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\o365\GraphService;
use Symfony\Component\HttpFoundation\RedirectResponse;

/**
 * The UserLoginController class.
@@ -80,7 +80,7 @@ class UserLoginController extends ControllerBase {
   * @param \Drupal\o365\O365ConnectorInterface $o365_connector
   *   The Office 365 connector entity.
   *
   * @return \Drupal\Core\Routing\TrustedRedirectResponse
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   The redirect to the set URL in config.
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
@@ -124,7 +124,7 @@ class UserLoginController extends ControllerBase {
    }
    elseif ($account->isBlocked()) {
      $this->messenger()->addError(t('The requested account is blocked'));
      return new TrustedRedirectResponse('/user/login');
      return $this->redirect('user.login');
    }

    // Log the user in.
@@ -134,19 +134,7 @@ class UserLoginController extends ControllerBase {
    $this->authenticationService->saveAuthDataFromCookie();

    // Return the redirect.
    return new TrustedRedirectResponse($redirectUrl);
  }

  /**
   * Synchronizes user data with attributes in the request.
   *
   * @param \Drupal\user\UserInterface $account
   *   The Drupal user to synchronize attributes into.
   * @param array $userData
   *   The user data from o365.
   */
  protected function synchronizeUserAttributes(UserInterface $account, array $userData) {
    // @TODO: Do something with attributes like name.
    return new RedirectResponse($redirectUrl);
  }

}