globaly denied access to user.register route; removed create new account link from login form; activated forgot password link

This commit is contained in:
Bachir Soussi Chiadmi 2021-01-28 13:19:57 +01:00
parent 4e6ccb23dc
commit 82e771574b
7 changed files with 80 additions and 19 deletions

View File

@ -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;
}

View File

@ -0,0 +1,5 @@
services:
materio_user.route_subscriber:
class: Drupal\materio_user\Routing\RouteSubscriber
tags:
- { name: event_subscriber }

View File

@ -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');
}
}
}

View File

@ -1313,6 +1313,9 @@ header[role="banner"] {
line-height: 1.2;
display: block;
padding: 0 0 0.8em 0; }
header[role="banner"] #block-userlogin span.login-message[v-if="loginMessage"],
header[role="banner"] #block-userlogin span.register-message[v-if="registerMessage"] {
display: none; }
header[role="banner"] #block-userblock h2 {
display: none; }
header[role="banner"] #block-userblock a {
@ -2389,6 +2392,9 @@ article.card {
line-height: 1.2;
display: block;
padding: 0.8em 0 0 0; }
#pricing-modal-login-register #login-register > section form span.login-message[v-if="loginMessage"],
#pricing-modal-login-register #login-register > section form span.register-message[v-if="registerMessage"] {
display: none; }
#main-content form.commerce-checkout-flow {
max-width: 641px; }
@ -2507,6 +2513,9 @@ article.card {
font-weight: 600;
font-size: 1.323em; }
form#user-pass input.form-email {
max-width: 95%; }
body:not(.path-home) footer[role="contentinfo"] {
display: none; }

File diff suppressed because one or more lines are too long

View File

@ -121,6 +121,10 @@ header[role="banner"]{
display: block;
padding: 0 0 0.8em 0;
}
span.login-message[v-if="loginMessage"],
span.register-message[v-if="registerMessage"]{
display: none;
}
}
// non-vue userblock
@ -1680,6 +1684,10 @@ article.card{
display: block;
padding: 0.8em 0 0 0;
}
span.login-message[v-if="loginMessage"],
span.register-message[v-if="registerMessage"]{
display: none;
}
}
}
section.login{
@ -1860,6 +1868,12 @@ article.card{
}
}
form#user-pass{
input.form-email{
max-width: 95%;
}
}
// ___ _
// | __|__ ___| |_ ___ _ _
// | _/ _ \/ _ \ _/ -_) '_|

View File

@ -34,12 +34,6 @@ export default {
name: 'base'
})
})
},
request_password () {
console.log('request_password');
},
create_account () {
console.log('create_account');
}
},
beforeMount() {