Skip to content
Snippets Groups Projects
Commit def4ae2b authored by Brian Canini's avatar Brian Canini
Browse files

Merge branch 'lee5151' into 'main'

Add "Hide Reset Password" From module

See merge request !67
parents 4a5e9c3a 3c53f50a
No related branches found
No related tags found
1 merge request!67Add "Hide Reset Password" From module
name: Hide Reset Password
type: module
description: Hides the Reset Password form from being accessed
core_version_requirement: ^10
services:
custom.route_subscriber:
class: Drupal\hide_reset_password\Routing\RouteSubscriber
tags:
- { name: event_subscriber }
\ No newline at end of file
<?php
namespace Drupal\hide_reset_password\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
class RouteSubscriber extends RouteSubscriberBase
{
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection)
{
$disallow_routes = [
'user.register',
'user.pass',
];
foreach ($disallow_routes as $disallow_route) {
if ($route = $collection->get($disallow_route)) {
$route->setRequirement('_access', 'FALSE');
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment