From a235a24932ba21799dee688456436e2018560205 Mon Sep 17 00:00:00 2001 From: Nicolas Went <35817305+NicolasWent@users.noreply.github.com> Date: Tue, 26 Jan 2021 19:50:04 +0100 Subject: [PATCH] Fixed registering The query that I have modified didn't changed the database because the fields accessToken and clientToken where null, this adding should fix this. Please not that I have not tested the full server but this fix comes from my fork. --- server/app/register.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/server/app/register.php b/server/app/register.php index ee1c563..c62f3be 100644 --- a/server/app/register.php +++ b/server/app/register.php @@ -43,8 +43,18 @@ // Hashing the given password $password = hash('sha256', $password); - // Sending a request to the database to add the user - Core\Queries::execute('INSERT INTO openauth_users (guid, uuid, username, password) VALUES (:guid, :uuid, :username, :password)', ['username' => $username, 'uuid' => $uuid, "password" => $password, 'guid' => $guid]); + $accessToken = md5(uniqid(rand(), true)); + $clientToken = getClientToken(); + + Core\Queries::execute( + 'INSERT INTO openauth_users (guid, uuid, username, password, accessToken, clientToken) VALUES (:guid, :uuid, :username, :password, :accessToken, :clientToken)', [ + 'username' => $username, + 'uuid' => $uuid, + 'password' => $password, + 'guid' => $guid, + 'accessToken' => $accessToken, + 'clientToken' => $clientToken] + ); // Setting the 'You are now suscribed' message $notif = "Vous ĂȘtes bien inscrits !"; @@ -120,4 +130,4 @@ - \ No newline at end of file +