Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

This module allows you to create fields that store passwords. It will store the passwords in encrypted format and (by default) will not display them on the website. This is useful, for example, if you are creating a website that integrates with other services and you would like users to be able to store their password more securely than using a text field. Using this module, you could create a password field and attach it to the user entity (just like any other field), knowing that the passwords will be stored in an encrypted format and won't be displayed to other users.

Note, this is completely different from the Password module that backports the pluggable and secure hashing from Drupal 7 to use with Drupal 6. This module is more like the Email Field or Phone modules in that it provides a field type.

A note on security

The most important thing to know about this module is that you should not use this module if you can possibly avoid it.

The reason for this rather strong statement is that, in general, storing passwords in a database is a bad idea. If you can store a salted hash of a password (like Drupal does), or an authorisation token (the way oAuth works), then you should do that instead. Sometimes though, there is a genuine need to store a password in a database, and you want to make sure that the data is at least encrypted. If you are in that situation, then this module is for you.

Please note, even though the passwords are stored in an encrypted format in the database, anyone who has access to your settings.php file and the values from the database should be able to figure out how to decrypt them with very little trouble - especially since this module is publicly available on drupal.org.

Accessing Passwords

If you are writing a module that relies on this one, you can fetch the encrypted value of the password using the standard Drupal Field API functions.

Once you have the encrypted value, you can decrypt it using the password_field_decrypt() function. For example:

global $node, $language;
module_load_include('module', 'password_field', 'password_field');

$langcode = $language['language'];
$lang  = (array_key_exists($langcode, $field_data)) ? $langcode : 'und';

$field_data = $node->field_password_field;
$parts = array_values($field_data[$lang][0]);

$password_value = password_field_decrypt($parts[0]);

Development of this module was supported by OPC IT

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Aug 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
2.0.0 Stable Aug 4, 2023
2.0.x-dev Dev Aug 4, 2023
8.x-1.1 Stable Aug 4, 2023