mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 00:25:18 +00:00
Can create accounts.
This commit is contained in:
@ -174,6 +174,30 @@ class Account {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Intend to create an account
|
||||
*
|
||||
* @param NewAccount $account The new account to create
|
||||
* @return bool TRUE in case of success / FALSE else
|
||||
*/
|
||||
public function create(NewAccount $newAccount) : bool {
|
||||
|
||||
//Crypt password
|
||||
$password = $this->cryptPassword($newAccount->password);
|
||||
|
||||
//Set the values
|
||||
$values = array(
|
||||
"nom" => $newAccount->lastName,
|
||||
"prenom" => $newAccount->firstName,
|
||||
"date_creation" => mysql_date(),
|
||||
"mail" => $newAccount->email,
|
||||
"password" => $password
|
||||
);
|
||||
|
||||
//Try to insert the user in the database
|
||||
return CS::get()->db->addLine(self::USER_TABLE, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Crypt user password
|
||||
*
|
||||
|
Reference in New Issue
Block a user