seckit.module in Security Kit 8
Same filename and directory in other branches
Allows administrators to improve security of the website.
File
seckit.moduleView source
<?php
/**
* @file
* Allows administrators to improve security of the website.
*/
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_form_FORM_ID_alter().
*/
function seckit_form_user_login_form_alter(&$form, FormStateInterface &$form_state) {
_seckit_form_alter_login_form($form, $form_state);
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function seckit_form_user_register_form_alter(&$form, FormStateInterface &$form_state) {
_seckit_form_alter_login_form($form, $form_state);
}
/**
* Form alteration helper for user login forms.
*/
function _seckit_form_alter_login_form(&$form, FormStateInterface &$form_state) {
$config = \Drupal::config('seckit.settings');
if ($config
->get('seckit_various.disable_autocomplete')) {
$form['#attributes']['autocomplete'] = 'off';
if (isset($form['pass'])) {
$form['pass']['#attributes']['autocomplete'] = 'off';
}
}
}
Functions
Name | Description |
---|---|
seckit_form_user_login_form_alter | Implements hook_form_FORM_ID_alter(). |
seckit_form_user_register_form_alter | Implements hook_form_FORM_ID_alter(). |
_seckit_form_alter_login_form | Form alteration helper for user login forms. |