function login_destination_user_login in Login Destination 8
Same name and namespace in other branches
- 8.2 login_destination.module \login_destination_user_login()
- 7 login_destination.module \login_destination_user_login()
Implements hook_user_login().
File
- ./
login_destination.module, line 44 - Control where users are directed to, once they login, register or logout.
Code
function login_destination_user_login(AccountInterface $account) {
if (isset($account->user_is_new) && $account->user_is_new) {
// User is just registered.
login_destination_perform_redirect('registration', $account);
}
elseif (\Drupal::service('current_route_match')
->getRouteName() === 'user.reset.login') {
if (\Drupal::config('login_destination.settings')
->get('immediate_redirect')) {
// User used an one-time login link.
login_destination_perform_redirect('one-time-login', $account);
}
}
else {
login_destination_perform_redirect('login', $account);
}
}