diff --git a/api/User/login.php b/api/User/login.php index 7947dbf..0883f96 100644 --- a/api/User/login.php +++ b/api/User/login.php @@ -10,6 +10,12 @@ // prepare user object $user = new User($db); // set ID property of user to be edited +if (isset($_GET['username'])) { + $user->username = $_GET['username']; +} +if (isset($_GET['password'])) { + $user->password = password_verify($_GET['password']); +} $user->username = isset($_GET['username']) ? $_GET['username'] : die(); $user->password = base64_encode(isset($_GET['password']) ? $_GET['password'] : die()); // read the details of user to be edited diff --git a/api/User/signup.php b/api/User/signup.php index 27e80f1..b3108c6 100644 --- a/api/User/signup.php +++ b/api/User/signup.php @@ -13,7 +13,7 @@ // set user property values $user->username = $_POST['username']; -$user->password = base64_encode($_POST['password']); +$user->password = password_hash($_POST['password'], PASSWORD_DEFAULT); $user->created = date('Y-m-d H:i:s'); // create the user diff --git a/api/objects/user.php b/api/objects/user.php index f6c2b60..e9989cf 100644 --- a/api/objects/user.php +++ b/api/objects/user.php @@ -3,7 +3,7 @@ class User{ // database connection and table name private $conn; - private $table_name = "users"; + private $table_name = "users_data"; // object properties public $id;