function login_security_submit in Login Security 2.x
Same name and namespace in other branches
- 8 login_security.module \login_security_submit()
- 7 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::messenger()
->addMessage(t('Your last login was @stamp.', [
'@stamp' => \Drupal::service('date.formatter')
->format($login, 'long'),
]), 'status');
}
$access = _login_security_access_timestamp();
if ($conf
->get('last_access_timestamp') && $access > 0) {
\Drupal::messenger()
->addMessage(t('Your last page access (site activity) was @stamp.', [
'@stamp' => \Drupal::service('date.formatter')
->format($access, 'long'),
]), 'status');
}
}
}