function login_security_submit in Login Security 8
Same name and namespace in other branches
- 7 login_security.module \login_security_submit()
- 2.x login_security.module \login_security_submit()
Implements hook_submit().
1 string reference to 'login_security_submit'
- login_security_form_alter in ./
login_security.module - Implements hook_form_alter().
File
- ./
login_security.module, line 252 - Login Security module hooks.
Code
function login_security_submit(array $form, FormStateInterface $form_state) {
$user = \Drupal::currentUser();
$conf = \Drupal::config('login_security.settings');
// The submit handler shouldn't be called unless the authentication succeeded.
if (is_object($user)) {
$login = _login_security_login_timestamp();
if ($conf
->get('last_login_timestamp') && $login > 0) {
drupal_set_message(t('Your last login was @stamp.', [
'@stamp' => format_date($login, 'long'),
]), 'status');
}
$access = _login_security_access_timestamp();
if ($conf
->get('last_access_timestamp') && $access > 0) {
drupal_set_message(t('Your last page access (site activity) was @stamp.', [
'@stamp' => format_date($access, 'long'),
]), 'status');
}
}
}