Add hook before account creation

This commit is contained in:
Nina 2021-10-19 18:16:20 -04:00 committed by Camille Lafitte
parent 8b64c144b2
commit 8dc23ccf06
1 changed files with 10 additions and 0 deletions

View File

@ -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?