getgrav / grav-plugin-login

Grav Login Plugin
http://getgrav.org
MIT License
44 stars 54 forks source link

Example of custom registration page #240

Closed hughbris closed 4 years ago

hughbris commented 4 years ago

Warning and apology: this may sound frustrated and that would be because I am currently frustrated. I'm going to do my best to remain respectful to the hardworking developers of this plugin.

I have been trying for several hours to follow the instructions and make a custom registration page work. I have dug through the code, tried every way I can interpret the README, tried several combinations of configuration options, and set breakpoints.

I'm seeing the form simply re-displayed with the fields blanked as if reloaded and no users are created. Inspector shows me that the form was posted with the field values correct and a 200 response is returned. The grav and webserver logs show no errors.

From setting breakpoints, it does appear that I cannot get onFormProcessed to fire.

Assuming this is not a new bug, what would really cut through the ambiguity of creating a custom registration form is a complete example, either in the documentation or by pointing me to a working example in a skeleton.

I would provide more information about my configuration and custom form, but they have changed so much that this seems pointless. Happy to answer any specific questions. I've used the login plugin successfully before, but this is my first attempt to allow registration.

Please consider reworking the README. It seems like it's been built on over time as features and options have been added and doesn't make much sense as a whole.

Thanks for reading to the end.

hughbris commented 4 years ago

OK the rubber ducky has spoken: my issue appears theme related. I'm using an as-yet unreleased custom theme. It's not clear yet which critical component I am omitting in my theme's form template. It began submitting when I switched to a near-copy of the plugin's form template.

I still think the documentation could benefit from review and a working example.

mahagr commented 4 years ago

It may help if you had your work available us to look at. :)

hughbris commented 4 years ago

While I get that, it seemed futile since the current state of my work is simply the last and most desperate iteration in a long line of attempts.

This is going to be hard to explain but I'll try :) I think my theming issue was because I created a custom form template for the signin template, and that worked because of some magic with the submit button attributes (name="task" and value="login.login").

I then based my registration custom template on that. That form behaves much more like a regular form. Its template did not include or extend templates from the form plugin, which it needed to behave like a regular form.

Something like that :/

I'll close this. It seems I just overlooked the special nature of the login form. Can't really make any concrete suggestions :&

mahagr commented 4 years ago

I believe that the login plugin hijacks the event early and prevents propagation. Try raising the priority of your event listener. Also, make sure you're passing all the needed information to login plugin, otherwise, it won't work.

Login plugin can also hijack the form earlier by some other event. It should propagate some other events though, which you could use.