Skip to content

Commit

Permalink
Add hook before account creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazamazine authored and camlafit committed Sep 29, 2023
1 parent 8b64c14 commit 8dc23cc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bureau/class/m_admin.php
Expand Up @@ -638,6 +638,16 @@ function add_mem($login, $pass, $nom, $prenom, $mail, $canpass = 1, $type = 'def
$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?
Expand Down

0 comments on commit 8dc23cc

Please sign in to comment.