Commit 4af47a5e authored by Rob Phillips's avatar Rob Phillips
Browse files

Issue #3324192 by robphillips: Allow safe HTML in redirect message.

parent a68dc85f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\require_login;

use Drupal\Component\Utility\Xss;
use Drupal\Core\Condition\ConditionAccessResolverTrait;
use Drupal\Core\Condition\ConditionPluginCollection;
use Drupal\Core\Config\ConfigFactoryInterface;
@@ -12,6 +13,7 @@ use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Plugin\Context\ContextHandlerInterface;
use Drupal\Core\Plugin\Context\ContextRepositoryInterface;
use Drupal\Core\Plugin\ContextAwarePluginInterface;
use Drupal\Core\Render\Markup;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\Core\Url;
@@ -188,8 +190,8 @@ class LoginRequirementsManager implements LoginRequirementsManagerInterface {
   * {@inheritdoc}
   */
  public function redirect(): Url {
    if ($message = $this->config->get('login_message')) {
      $this->messenger->addWarning($message);
    if ($message = trim($this->config->get('login_message'))) {
      $this->messenger->addWarning(Markup::create(Xss::filterAdmin($message)));
    }
    $uri = $this->config->get('login_path');
    if (!($destination = $this->config->get('login_destination'))) {