globaly denied access to user.register route; removed create new account link from login form; activated forgot password link
This commit is contained in:
@@ -128,17 +128,20 @@ function materio_user_block_view_user_login_block_alter(array &$build, BlockPlug
|
||||
function _materio_user_user_login_block_pre_render(array $build){
|
||||
$user_links = &$build['content']['user_links'];
|
||||
$items = &$user_links['#items'];
|
||||
// ksm($items);
|
||||
$items['create_account']['#url']->mergeOptions(array(
|
||||
"attributes" => array(
|
||||
"@click.prevent" => "create_account"
|
||||
)
|
||||
));
|
||||
$items['request_password']['#url']->mergeOptions(array(
|
||||
'attributes' => array(
|
||||
"@click.prevent" => "request_password"
|
||||
)
|
||||
));
|
||||
|
||||
unset($items['create_account']);
|
||||
// $items['create_account']['#url']->mergeOptions(array(
|
||||
// "attributes" => array(
|
||||
// "@click.prevent" => "create_account"
|
||||
// )
|
||||
// ));
|
||||
|
||||
// Do not handle passward reset with vue
|
||||
// $items['request_password']['#url']->mergeOptions(array(
|
||||
// 'attributes' => array(
|
||||
// "@click.prevent" => "request_password"
|
||||
// )
|
||||
// ));
|
||||
return $build;
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,5 @@
|
||||
services:
|
||||
materio_user.route_subscriber:
|
||||
class: Drupal\materio_user\Routing\RouteSubscriber
|
||||
tags:
|
||||
- { name: event_subscriber }
|
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\materio_user\Routing;
|
||||
|
||||
use Drupal\Core\Routing\RouteSubscriberBase;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* Listens to the dynamic route events.
|
||||
*/
|
||||
class RouteSubscriber extends RouteSubscriberBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function alterRoutes(RouteCollection $collection) {
|
||||
// // Change path '/user/login' to '/login'.
|
||||
// if ($route = $collection->get('user.login')) {
|
||||
// $route->setPath('/login');
|
||||
// }
|
||||
// // Always deny access to '/user/logout'.
|
||||
// // Note that the second parameter of setRequirement() is a string.
|
||||
// if ($route = $collection->get('user.logout')) {
|
||||
// $route->setRequirement('_access', 'FALSE');
|
||||
// }
|
||||
|
||||
// redirect /user/register to pricing
|
||||
if ($route = $collection->get('user.register')) {
|
||||
$route->setRequirement('_access', 'FALSE');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user