public function SecuresiteManager::userLogin in Secure Site 8
2 calls to SecuresiteManager::userLogin()
- SecuresiteManager::digestAuth in src/
SecuresiteManager.php - Perform digest authentication.
- SecuresiteManager::plainAuth in src/
SecuresiteManager.php
File
- src/
SecuresiteManager.php, line 197 - Contains \Drupal\securesite\SecuresiteManager.
Class
Namespace
Drupal\securesiteCode
public function userLogin($edit, AccountInterface $account) {
global $user;
if ($account
->hasPermission('access secured pages')) {
\Drupal::currentUser()
->setAccount($account);
$newUser = User::load($account
->id());
user_login_finalize($newUser);
// Mark the session so Secure Site will be triggered on log-out.
$_SESSION['securesite_login'] = TRUE;
// Unset the session variable set by securesite_denied().
unset($_SESSION['securesite_denied']);
// Unset messages from previous log-in attempts.
unset($_SESSION['messages']);
// Clear the guest session.
unset($_SESSION['securesite_guest']);
// Prevent a log-in/log-out loop by redirecting off the log-out page.
if (current_path() == 'user/logout') {
$response = new RedirectResponse('/');
$response
->send();
}
return $account;
}
else {
$this
->denied(t('You have not been authorized to log in to secured pages.'));
}
}