I have installed the module, set the required age.When going to site default root(/) you are redirected to the age form and when you set the correct age on submit you are redirected to the same form(like nothing happened).If you set the wrong age you get the notice.Also, I notice that when you go to /node/*, you are not redirected to age verification even when you first visit the site(no cookie set yet) so at this point, I think this module is completely unusable in Drupal 8.

CommentFileSizeAuthor
#7 2958066-07-eventSubscriber.patch10.38 KBgavin.hughes

Comments

nkoporec created an issue. See original summary.

_bryanxu’s picture

The processInbound is only called once. Should use Event Subscriber instead.

BigEd’s picture

Thanks for the info this might have been a recent change as we were not seeing these issues, I will do some testing on this and update accordingly.

Patches are welcome.

LiquiDetail’s picture

I would like to help get this up and running but would like some guidance. If someone could point me in the right direction for fixing this module. I am under a timeline and need this pretty quick. Please Advise

BigEd’s picture

Sorry, I was away on holiday when you posted this.

Yes any help is good, but actually, I don't think there is too much to do to get the basic functionality bug free again I will try and take a look through later and make suggestions for where we can make changes and see if can get this running again quickly for you. It was working ok recently but due to the large changes with the way D8 works it just needs to be realigned.

Then we are also talking about extra feature requests, what is it that you need that is not provided already?

BigEd’s picture

I have had some time to look at this and it looks like a simple fix, I going to make a new patch.

Looks like it just needs a change to the default value before you set admin configuration for the module as you can't access the login form to set the admin configuration settings without it, I guess this must have been a change somewhere along the development of D8 as this module was built in early Alpha.

gavin.hughes’s picture

StatusFileSize
new10.38 KB

So ya know how it is ya start out to fix a bug and then ya turn around and realize you've completely lost the run of yourself!

I couldn't get this working reliably in the last few versions using drupal core and fresh install. I'm not sure if moving to an event subscriber is the best way to go but it does seem that processInbound is cached or there is issues with using this caching and the redirection to the intended request.

So this patch might serve as the basis if moving to event subscriber.

I made other changes
- used the destination parameter to send the user to their requested url (I don't know if thats the best way to do things)
- the skip paths is done with urls without a / prefix considering that the rest of drupal 8 blocks etc don't do this then I think this should follow the same routine.

Don't shoot me for getting carried away!!

baikho’s picture

Status: Active » Needs review
BigEd’s picture

Thanks, Gavin, yes I know what you mean once you start making changes in code you just start writing and making changes till late in the night. I was aware the changes in D8 needed to have been kept up with and agree it needs to move across. The issue has been just opening the file up and making the changes seems to be on my forever to do list.

I reckon that there is a use case for this module so I will get this moved across so the module is working well, moving to the event subscriber will solve a few issues with this module.

No i won't shoot you ha, I really appreciate you starting this as it gives me a kick up the bum to work on it. Lets get this reviewed and a new patch as there's a couple of other fixed I need to merge into a new dev release.

BigEd’s picture

@gavin.hughes Picking this up for testing and its not actually not to bad for changes, they make sense.

There are quite a few things that I haven't dealt with yet like ignoring on admin paths I notice you corrected the /admin. I am thinking it would be better to check if the user has roll rather than hardcoded path values.

I will probably roll this and a couple of other things I am thinking of changing into separate issues and move this through.

BigEd’s picture

+++ b/age_verification.services.yml
@@ -1,5 +1,6 @@
+      - { name: 'event_subscriber' }

+++ b/config/install/age_verification.settings.yml
@@ -1,5 +1,5 @@
diff --git a/src/AgePathProcessor.php b/src/AgePathProcessor.php

diff --git a/src/AgePathProcessor.php b/src/AgePathProcessor.php
deleted file mode 100644

deleted file mode 100644
index f5fc09e..0000000

index f5fc09e..0000000
--- a/src/AgePathProcessor.php

--- a/src/AgePathProcessor.php
+++ /dev/null

+++ /dev/null
+++ /dev/null
@@ -1,100 +0,0 @@

@@ -1,100 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\age_verification\AgePathProcessor.
- */
-
-namespace Drupal\age_verification;

+++ b/src/EventSubscriber/pathGate.php
@@ -0,0 +1,152 @@
+<?php
+

Failed
error: patch failed: src/AgePathProcessor.php:1
error: src/AgePathProcessor.php: patch does not apply

Needs to be rerolled against updated version

I can look at this and repatch it.

BigEd’s picture

Made changes and merged to 8.1-alpha1

Thanks @gavin.hughes

BigEd’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.