## Authentication: Email-based self-registration with admin confirmation

Maintained by Felipe Carasso
1294 sites
94 fans
Current versions available: 5

Moodle plugin to provide email self-registration with admin confirmation.

The confirmation email is sent to the main admin account's email address.

When the admin clicks on the confirmation link, a "welcome" email is sent to the user.

Email body needs to be customized within the language file.

Based on default email-based self-registration module.

What's new in 1.4.4
================

fix(ISSUE-29): repairs config reference for Captcha after Settings API migration

What's new in 1.4.3
================
fix(ISSUE-17): repairs lock user fields, db update
feat(ISSUE-18): adds support for notifying users with user update capability
fix(ISSUE-21): updates config to use settings api
fix(ISSUE-25): makes use of lib function to gather profile fields

What's new in 1.4.2
================

### Awards

• Fri, Nov 25, 2016, 3:50 AM
Solved (I hope). I made a lot of fake registrations using a temporary email service (mailinator.com). When I tried to change domain, I started to receive email notification. Why is a mistery for me, but fortunately the issue is dead. Thank you for your patience.
• Thu, Jan 5, 2017, 2:14 PM
Our institution is using your plugin for external users to apply a Moodle account. to show the user account, password and email address in the notification email to applicants, we customise the language of auth_emailadmin/auth_emailadminuserconfirmation in the website site administration/language/language customisation, as can be seen below. https://pan.baidu.com/s/1jI0otG6

However, there is a problem in the notification email, as can be seen below. The “.” in the user name is shown as “%2E”, which is the URL encoding of a dot. https://pan.baidu.com/s/1bZ0n0M

It is defined in the code to change a dot to “%2E” in the file confirm.php. https://pan.baidu.com/s/1c2qXeZe

However, it is also defined in the file auth.php for the notification email to system administrator about a user account application. But the way of programing is a little different from the one above. The user name displays correct in the email to the system administrator. https://pan.baidu.com/s/1eRRQ9kI

Since the wrong usernames confuse users a lot when they get the confirmation email, it would be nice if you could solve the problem soon. Thank you very much!
• Mon, Feb 27, 2017, 1:05 AM
Hello Felipe,

Thank you for the plugin. I am attempting to use it with Moodle 3.2.1+ and no matter what I do, the "Is this your first time here / Create New Account" section never appears on the login page. In Plugins/Auth/Manage Auth, the plugin is enabled, and "Email-based self-registration with admin confirmation" is selected under "Self registration". Originally I was using PHP 7.1, but reverted to PHP 5.6, with the same results. Turning on debug messages shows no useful error messages.

If I choose the out-of-the-box "Email-based self-registration", the "Is this your first time here / Create New Account" text is displayed, so it appears to be something particular to this plugin.

Would you mind helping? I'd appreciate any help that you could provide!

• Mon, Feb 27, 2017, 2:15 AM
I worked it out. In file /auth/classes/output/login.php, there is the following code (hopefully this shows up in the forum):

// Authentication instructions.
$this->instructions =$CFG->auth_instructions;
if (is_enabled_auth('none')) {
$this->instructions = get_string('loginstepsnone'); } else if ($CFG->registerauth == 'email' && empty($this->instructions)) {$this->instructions = get_string('loginsteps', 'core', 'signup.php');
}

I had to add this code below it on line 106 or 107:

else if ($CFG->registerauth == 'emailadmin' && empty($this->instructions)) {
}

After this, it seems to work fine.
• Mon, Feb 27, 2017, 2:26 AM
Hey Tim,

I faced the same issue, but I solved it by specifying registration instructions inot the configuration. Would you try that with the vanilla code to see if it works for you?

Thank you,
Felip
• Mon, Feb 27, 2017, 2:55 AM
Thanks, Felipe. That worked. May I suggest a note in the setup instructions and documentation for future users? Thanks, again!
• Mon, Mar 6, 2017, 6:07 AM
Hey Tim, your suggestion was executed. Thank you!
• Wed, Mar 22, 2017, 9:04 PM
Hallo Felipe,

i have the same problem like Tim.

"Hello Felipe,

Thank you for the plugin. I am attempting to use it with Moodle 3.2.1+ and no matter what I do, the "Is this your first time here / Create New Account" section never appears on the login page. In Plugins/Auth/Manage Auth, the plugin is enabled, and "Email-based self-registration with admin confirmation" is selected under "Self registration". Originally I was using PHP 7.1, but reverted to PHP 5.6, with the same results. Turning on debug messages shows no useful error messages.

If I choose the out-of-the-box "Email-based self-registration", the "Is this your first time here / Create New Account" text is displayed, so it appears to be something particular to this plugin."

What do you mean with "try that with the vanilla code"?

Thank you,
Daniel
• Wed, Mar 22, 2017, 9:26 PM
Hi Daniel,

Have you tried the INSTALL (https://github.com/hrimhari/moodle-auth_emailadmin/blob/master/INSTALL) document yet? If you can't find your solution in there, it could mean that I need to improve it.

Thank you!
Felipe
• Fri, Mar 31, 2017, 9:05 PM
Hi!
But there is one strange behaviour: there are two ways for confirmation - one using link from email, second - from user list (admin->users->user list). But approved email to user is sent only by using first one. I think both ways must do the same thing.

Thank you.
• Fri, Mar 31, 2017, 9:15 PM
Hi Sergey,

You're right. When I wrote the plug-in, I believe there was no standard way to do it, but now there is. I'll update the plug-in accordingly. Version 1.4.0 soon to be released!

Best regards,
Felipe
• Thu, Apr 6, 2017, 11:26 AM
As promised, the new version will now send the 'welcome message' to the user regardless of how you confirm the account, so you can use any method available, be it the link, the admin/user-confirm or the admin/bulk-user-confirm.

Cheers!
Felipe
• Sat, Apr 15, 2017, 4:58 PM
On registration page, I need to capture few more fields. How can I add more fields? Please provide help.
• Sat, Apr 15, 2017, 7:22 PM
Hi Nikhil,

You're probably looking for custom profile fields. If I'm not mistaken, you can add them under the account profile configuration. You can use the search field in moodles to find it.

Best regards,
Felipe
• Sat, Apr 22, 2017, 10:20 AM
Hello Felipe,

Your plugin in wonderful, but I have a problem that I can't seem to fix.

I edited the message that would be sent to a user after I confirm their registration. However, the email that is sent out is the same as it was before I changed it. I changed it in the auth_emailadmin.php file. I thought maybe I hadn't saved the changes, but nope. When I went back to look at the file, it was definitely changed. I tested it again. Same problem. The original message is sent to the user. So I thought that maybe the same wording is in another file somewhere, but after hours and hours of searching, I can't find anything.

The beginning of the original says this: "Welcome to (My Organization)! Your account has been approved. If you have not already done so, please tell us how you discovered (My Organization)." It goes on for several paragraphs. I deleted all those paragraphs and wrote a more simple message that is more relevant to my users. But it doesn't get sent.

Am I missing something somewhere? Everything else seems to be working well enough. Well, except the message to me after someone registers. The link in that one takes me to what is essentially a blank page. I don't care about that, though, since it's easy to go to my Moodle site and confirm the registration. The original wording going out to confirmed registrants, however, is embarrassing.

Hope you can help me.