LoginEvent should not be triggered if user registration failed

Created on 27 March 2024, 9 months ago

Problem/Motivation

Code in reference

$redirect = $this->userAuthenticator->authenticateUser($social_auth_user);
$event = new LoginEvent($this->currentUser(), $social_auth_user, $this->pluginId);

If for whatever reason authenticateUser fails (when trying to create account it fails some validation), LoginEvent is still triggered.

Steps to reproduce

  • Register with Social channel (new email, registration scenario)
  • Add some validation during registration (in our case, we try to invoke 3rd party API), make sure authenticateUser fails

Proposed resolution

Don't call LoginEvent and code after if authenticateUser fails

🐛 Bug report
Status

Active

Version

4.1

Component

Code

Created by

🇮🇳India gulfam_drupal Bangalore

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024