You are here

seckit.module in Security Kit 8

Same filename and directory in other branches
  1. 6 seckit.module
  2. 7 seckit.module
  3. 2.x seckit.module

Allows administrators to improve security of the website.

File

seckit.module
View 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