Проект ещё жив!

This commit is contained in:
2023-12-20 06:08:13 +03:00
parent a573faf5a1
commit 8d74a51937
23 changed files with 358 additions and 143 deletions

View File

@ -16,13 +16,15 @@ require_once("index.php");
* Create new user account
*/
function User_Create (string $login, string $password, ?string $email = null, ?string $invite_id = null, ?string $avatar_path = null): ReturnT {
global $db;
$salt = Utils_GenerateRandomString(8);
$pwd_hash = hash("sha256", $password . $salt, true);
// TODO: process invite
$s = $db->prepare("INSERT INTO users (login,email,password_hash,salt,avatar_path,role,invite_id) VALUES (?,?,?,?,?,?,?)");
$role = "newbie"; // TODO: make decision from config
$role = "newbie"; // TODO: make decision from config or supply by argument
$s->bind_param("sssssss", $login, $email, $pwd_hash, $salt, $avatar_path, $role, $invite_id);
if ($s->execute() === false)
@ -40,7 +42,7 @@ function User_Create (string $login, string $password, ?string $email = null, ?s
* Create new user account
*/
function User_Create_Method (array $req): ReturnT {
global $db, $Config, $LOGGED_IN;
global $Config, $LOGGED_IN;
$login = null;
$password = null;