Registration code (simple)

Component ID

2264099

Component name

Registration code (simple)

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

1681

Component created

Component changed

Component body

Registration code (simple) -module gives site administrators means to limit registering users to user with a known password ("registration key"). When a registration code ise set, registering users must provide a valid password during the registration along with other normal registration information.

Password types

For the password validation (and complexity) logic following options are available. These can configured on the Account settings (admin/config/people/accounts) -page.

Password types and behavior

Plain text

Administrator may set one or more valid passwords, thus new Registration codes can be added as needed. However, managing huge amount of individual codes may be cumbersome and is also error prone.

Regular expression

Administrator may set one regular expression and any Registration code matching to this regular expression is valid. This allows more or less infinite amount of passwords to be created, but obviously simple regular expression matches infinite amount of other codes as well. Be careful.

Salt for username

Administrator may set a salt, that will be used when calculating a hash (see PHP mkd5() -function) from username + salt. Using this method allows infinite amount of individual registration codes.

Salt for user's email

Administrator may set a salt, that will be used when calculating a hash (see PHP mkd5() -function) from user's email address + salt. Using this method allows infinite amount of individual registration codes.

Salt for user's email domain

Administrator may set a salt, that will be used when calculating a hash (see PHP mkd5() -function) from user's email address domain + salt. Using this method allows one password for for example single company email domain - might work as an intranet registration guard without administrators needing to accept all user accounts individually.

Warning

Code change has an immediate effect. So if you have provided for example a Salt for user's email domain, sent a hash code to users and then change the salt or code type altogether, old codes won't work anymore. For individual registration code -tokens Registration codes -module may be helpful for example for "personal code" -scenarios.

Installation

* Install as you would normally install a contributed Drupal module. See: https://drupal.org/documentation/install/modules-themes/modules-7 for further information.

Configuration

  • Go to the code in Account settings -page: Administration » People » Permissions » Account settings (admin/config/people/accounts)
  • Select registration code type
  • provide codes, regex or salt as applicable
  • save and test user registration page

After the code is set User registration form will require users to use code to allow registrations to the site.

Disabling

Drupal 8: Uninstall the module to remove code requirement from User registration -page.

Drupal 7: Either remove the code in Account settings -page or disable the module.

Drupal 7 limitations

Drupal 7 -version has only one option for the password; one plaintext registration code.

Contributions and tests

This module has Functional PHPUnit -tests. In case of new contributions (new kinds of codes or alike) include also new tests with the pathces, thank you.