public function UserAuthenticator::loginUser in Social Auth 8.2
Same name and namespace in other branches
- 3.x src/User/UserAuthenticator.php \Drupal\social_auth\User\UserAuthenticator::loginUser()
Logs the user in.
Parameters
\Drupal\user\UserInterface $drupal_user: User object.
Return value
bool True if login was successful False if the login was blocked
2 calls to UserAuthenticator::loginUser()
- UserAuthenticator::authenticateExistingUser in src/
User/ UserAuthenticator.php - Authenticates and redirects existing users in authentication process.
- UserAuthenticator::authenticateNewUser in src/
User/ UserAuthenticator.php - Authenticates and redirects new users in authentication process.
File
- src/
User/ UserAuthenticator.php, line 353
Class
- UserAuthenticator
- Manages Drupal authentication tasks for Social Auth.
Namespace
Drupal\social_auth\UserCode
public function loginUser(UserInterface $drupal_user) {
// Check that the account is active and log the user in.
if ($drupal_user
->isActive()) {
$this
->userLoginFinalize($drupal_user);
// Dispatches SocialAuthEvents::USER_LOGIN event.
$event = new UserEvent($drupal_user, $this
->getPluginId());
$this->eventDispatcher
->dispatch(SocialAuthEvents::USER_LOGIN, $event);
return TRUE;
}
$this->loggerFactory
->get($this
->getPluginId())
->warning('Login for user @user prevented. Account is blocked.', [
'@user' => $drupal_user
->getAccountName(),
]);
return FALSE;
}