From 8dc23ccf06a1fc7f93236dae0be0084253b62419 Mon Sep 17 00:00:00 2001 From: Nina Date: Tue, 19 Oct 2021 18:16:20 -0400 Subject: [PATCH] Add hook before account creation --- bureau/class/m_admin.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bureau/class/m_admin.php b/bureau/class/m_admin.php index c2e7d27c..ef3c8200 100644 --- a/bureau/class/m_admin.php +++ b/bureau/class/m_admin.php @@ -638,6 +638,16 @@ class m_admin { $msg->raise("ERROR", "admin", _("Login can only contains characters a-z, 0-9 and -")); return false; } + // Additional checks before a user is created + // Do not create the account if any hook returned false + $before_add_hook_data = $hooks->invoke('hook_before_alternc_add_member', [$login]); + foreach($before_add_hook_data as $create) { + if(!$create) { + $msg->raise("ERROR", "admin", _("-- I cannot create this account --")); + return false; + } + } + $pass = password_hash($pass, PASSWORD_BCRYPT); $db = new DB_System(); // Already exist?