Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moodle-auth_enrolkey #85

Open
jlhollowell opened this issue Nov 13, 2021 · 4 comments
Open

moodle-auth_enrolkey #85

jlhollowell opened this issue Nov 13, 2021 · 4 comments

Comments

@jlhollowell
Copy link

I'd really like to use this with Moodle 3.11. I understand you are busy and resources are limited. My financial resources at the moment are limited as well but I do have some time to poke around in the code and try to help get this working on 3.11. I am, however, not a professional coder by any means...more of a wanna-be hacker.

I've installed this plugin on Moodle 3.11 without any errors and see that it runs without throwing any errors when debugging is enabled.

The plugin accurately tests for an empty enrollment key, when one is required and displays the subsequent error message.

It does not, however, correctly match enrollment keys and thus prevents new users even when they have supplied a correct (matching) enrollment key throwing the error:

"The enrolment key you have entered is invalid"

If you could point me in the correct direction, I will experiment and see what I can achieve...and, of course, share any progress.

Regards

Jason

@brendanheywood
Copy link
Contributor

I just tested this on master which is soon to be 4.0 and it worked for me. Can you provide some reproduction steps in a vanilla install?

@jlhollowell
Copy link
Author

jlhollowell commented Nov 19, 2021

Brendan,

Thanks for the reply here and sorry for taking some time to respond. Let's see, here is what I have:

  1. Moodle 3.11+ (relatively fresh install - 3rd party theme (Fordson) is the only non-core addition aside from the auth_enrolkey plugin).
  2. Running on Ubuntu 20.04.2, MariaDB (10.5.12), Nginx (1.18.0)
  3. I installed the auth_enrolkey plugin with no errors displayed or recorded in logs

Setup

  1. Enabled "Enrolment key based self-registration" and am using the following settings:
  • Require enrolment key for validation = Yes
  • Enable reCAPTCHA element = No
  • Require email confirmation = Yes
  1. Selected "Enrolment key based self-registration" from the "Common settings" for "Self registration"
  2. In Enrloment methods for my 'test' course I have added Self enrolment and Enrolment key based enrolment.
  3. I have set the enrolment key for both methods listed in 3 above and left all other enrolment method settings on their defaults.

When I access my site and attempt to create a new account, I am presented with the self enrolment screen that prompts for an enrollment key but always get the

"The enrolment key you have entered is invalid"

error. I've tried using the key included in the regular self enrollment method as well as, of course, the one in the enrollment key method but none work. I also noted that attempting to create an account with no key entered, produces a different error.

"Missing enrolment key"

My novice assumption is that the plugin is checking for the enrolment key but, for some reason, not finding a match. Maybe there is a record somewhere in a log to provide more information about what is occurring?

Thanks for your time and please let me know what other information I can provide or what tests I can run.

Regards

Jason

@brendanheywood
Copy link
Contributor

I'm sorry I've tested this again and can't break it. All I can suggest is poking around a few bits of code and adding some debugging to see where exactly it's breaking. The code for this is here:

https://github.com/catalyst/moodle-auth_enrolkey/blob/master/classes/form/enrolkey_signup_form.php#L140-L166

See if it is actually finding any passwords, and then make sure they are enabled etc.

As for adding some more debugging or events that's all possible. The plugin already emits log events for successful signups but we could also log failures, but I'm not sure it would tell you anything you don't already know - what you need is why exactly it fails.

@jlhollowell
Copy link
Author

jlhollowell commented Nov 28, 2021

Brendan,

Thanks again. I've just tested this, just to be sure, on a purely 'vanilla' new install of 3.11 and can confirm the same behavior. No matter what enrollment key is used I get the "The enrolment key you have entered is invalid" error.

It seems somewhat odd that this would work on 4.0 but not on 3.11 but anything is possible I guess. I'll poke around with the debugging code and see if I can make any progress.

Regards

Jason

Edit - I figured out the problem...my problem! I had installed the 'master branch' which does not work on Moodle 3.11. I didn't notice the VERSION3 branch until today, just after posting the above message. I updated to VERSION3 and now everything works without issue. Although it is listed for Moodle 3.10+ it might help to make this a bit more apparent and/or update the package on Moodle.org to include this 3.10+ version. I see there are others there that are hoping to be able to use it with later versions of Moodle. For now, I'll add a link in the comments on Moodle.org sending people here. ;-)

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants