Registration Restriction allows a site admin to restrict user registration based on whitelisting or blacklisting particular email domains.

An example use case is a school or organization that wants to restrict account creation to emails from their own domain.

A large portion of this code was adapted from this discussion thread which also serves as a justification for this kind of functionality.

Future plans would include using a regular expression to check for valid/invalid email domains which would make it much more flexible and easier to initialize with a more reasonable default value (like * to allow all email domains).

If there's already a module that provides this functionality, let me know. I didn't find anything but might not have been looking in the right places.

Project page: http://drupal.org/sandbox/aboutblank/1872752
Repo: git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/aboutblank/1872752.git registration_restriction

Reviews of other projects

https://drupal.org/node/1884178#comment-6920818
https://drupal.org/node/1880994#comment-6918146
https://drupal.org/node/1865074#comment-6905742

Thank you!!
// Jason

Comments

aboutblank’s picture

Issue tags: +PAreview: review bonus

Adding PAReview: review bonus tag.

fr3shw3b’s picture

Status: Needs review » Needs work

Hello aboutblank,

first of all the automatedreview tool gives quite a few coding standard issues:
http://ventral.org/pareview/httpgitdrupalorgsandboxaboutblank1872752git

manual review:

Comments need full stops and need to be descriptive.

It's best to use the drupal equivelent to strlen() and use drupal_strlen() and drupal_substr() instead of substr().

You also want to keep the naming convention consistent so in the README file you'll want to stick to the Registration Restriction title and in implement hook comments you don't need to put the parameters in.

So it would simply be:

/**
 * Implements hook_form_alter().
 */
aboutblank’s picture

Cool, thanks.

- I fixed most of the issues from the automatedreview tool. It's still showing that two comments are too short, but if they are on one line, it excedes the 80 character limit. If I'm missing something here, let me know.

- I added full stops to all comments and made them more descriptive.

- Replaced strlen() and substr() with drupal_substr() and drupal_strlen()

- Fixed the typo for the module title in README.txt.

- Removed parameters from hook comments.

Thanks!

aboutblank’s picture

Status: Needs work » Needs review

Setting to "Needs review."

vladimir-m’s picture

Status: Needs review » Needs work

Hello aboutblank,

Thanks very much for submitting this great module.

Please correct grammar mistake @file registration_restriction.module Line: 63
'description' => 'Settings for restricting user registration to spcified email domains',
spcified to specified

Cheers!

aboutblank’s picture

Status: Needs work » Needs review

D'oh! Thanks :)

Typo fixed in registration_restriction.module.

monymirza’s picture

Status: Needs review » Needs work
aboutblank’s picture

Status: Needs work » Needs review

Thanks, those were giving me some trouble but I figured out how to fix it.

pareview passing: http://ventral.org/pareview/httpgitdrupalorgsandboxaboutblank1872752git

hhhc’s picture

Hi,

the idea of the module is pretty cool.

A few points from my side:

1)

Warning: This module initializes with no valid emails. If you turn on this
module and do not configure a list of valid email domains, no one will be able
to register for your site!')

I'd rather suggest to set standard value of "Blacklist listed domains" to checked so that there are no side-effects between module activation and configuration.
If you want to keep the logic like this maybe you could think about adding a message indicating that this logic applies. At least the status report should contain it.

2)
The chosen package name "User registration" could be replaced by "Users" which is frequently used also by other modules.

3)
Role "administer users" is used. In some of my projects we do differentiate between administration and daily operations. I would consider the limitation of registrations quite sensitive so I'd rather keep that for admins only with a dedicated role.

Thanks for working on this. Looks really good.

fr3shw3b’s picture

Status: Needs review » Reviewed & tested by the community

Hello again,

In testing the module itself it seems to work as purposed.

1. There's a missing full stop in the install file doc block.

2. Something that's more of a preference than anything else would be to rename the configuration page title to simple Registration Restriction Settings as it sits nicer and you don't particularly have to state "module" in it's config page title.

I tested the input for potential security vulnerabilities but can safely say in terms of what the user can input there aren't any vulnerabilities.

To me this is RTBC, I guess as it is a small module so it can make the process a whole lot quicker, well done.

aboutblank’s picture

@hhhc- Great suggestion for the initial standard value there, that makes a lot of sense.

- I changed the default initial value for that field to be set to 1 (Blacklist the domains). I removed the initialization warning as that's not a problem anymore. It's now initialized as blacklisting no email domains.
- I moved it to the "Users" package.

I'll work on a dedicated permission setting for this.

@fr3shw3b
- I added full stop to end of the install file doc block.
- I changed the config title to "Registration Restriction Settings."

Thanks, all!

klausi’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

http://drupal.org/project/useremaildomain

This sounds like a feature that should live in the existing User Email Domain project. Module duplication and fragmentation is a huge problem on drupal.org and we prefer collaboration over competition. Please open an issue in the User Email Domain issue queue to discuss what you need. You should also get in contact with the maintainer(s) to offer your help to move the project forward. If you cannot reach the maintainer(s) please follow the abandoned project process.

If that fails for whatever reason please get back to us and set this back to "needs review".

aboutblank’s picture

Great, thanks, klausi. I figured there was something else out there that included this functionality, but just hadn't found it.

sidharthap’s picture

Hello Guys,

I came across this module and corrected few things. I believe this will work in D7 without any issue and also i want to maintain this module for D8.
#13 aboutblank : Could you please grant me to commit the changes.

Regards
Sidhartha

klausi’s picture

@sidharthap: please post all your changes as patches to http://drupal.org/project/useremaildomain and/or request maintainership there.

PA robot’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

I'm a robot and this is an automated message from Project Applications Scraper.