From 41ed9f1ab3c2fdb9855469552a08caed2870293f Mon Sep 17 00:00:00 2001 From: Sergey Zakharevich Date: Wed, 14 Oct 2020 13:42:26 +0300 Subject: [PATCH] 40 #comment Add event after registration --- classes/AuthHelperManager.php | 6 ++++-- models/User.php | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/AuthHelperManager.php b/classes/AuthHelperManager.php index f642ec2..2e265a0 100644 --- a/classes/AuthHelperManager.php +++ b/classes/AuthHelperManager.php @@ -269,11 +269,13 @@ public function register(array $arCredentials, $bActive = false, $bAutoLogin = f // Prevents revalidation of the password field // on subsequent saves to this model object $obUser->password = null; - + if ($bAutoLogin) { $this->user = $obUser; } - + + Event::fire(User::EVENT_AFTER_REGISTRATION, [$obUser]); + return $obUser; } diff --git a/models/User.php b/models/User.php index 3e2f211..2f9f043 100644 --- a/models/User.php +++ b/models/User.php @@ -72,6 +72,7 @@ class User extends UserModel const EVENT_BEFORE_LOGIN = 'lovata.buddies.before.login'; const EVENT_AFTER_LOGIN = 'lovata.buddies.after.login'; + const EVENT_AFTER_REGISTRATION = 'lovata.buddies.after.registration'; const EVENT_LOGOUT = 'lovata.buddies.logout'; public $table = 'lovata_buddies_users';