Use id_phone instead of number in scheduled, use ftok to generate queue id, improve adapter interface, add popup error

This commit is contained in:
osaajani 2020-03-04 01:40:47 +01:00
parent 66fa2ef434
commit 6f8c7d62b9
25 changed files with 195 additions and 180 deletions

View file

@ -59,16 +59,15 @@ namespace controllers\internals;
new \daemons\Phone($phone);
}
/**
* Create a user or update an existing user
* Create a user or update an existing user.
*
* @param $email : User email
* @param $password : User password
* @param $admin : Is user admin
* @param $api_key : User API key, if null random api key is generated
* @return void : exit status 1 on error, else 0
* @param $api_key : User API key, if null random api key is generated
*/
public function create_update_user (string $email, string $password, bool $admin, ?string $api_key = null)
public function create_update_user(string $email, string $password, bool $admin, ?string $api_key = null)
{
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8');
$internal_user = new \controllers\internals\User($bdd);
@ -78,11 +77,10 @@ namespace controllers\internals;
{
$api_key = $api_key ?? $internal_user->generate_random_api_key();
$success = $internal_user->update($user['id'], $email, $password, $admin, $api_key);
exit($success ? 0 : 1);
}
$success = $internal_user->create($email, $password, $admin, $api_key);
exit($success ? 0 : 1);
}