From 0517f85ccb14df9e060a68d50383a58e5ed1d19f Mon Sep 17 00:00:00 2001 From: Ilham Firdausi Putra <ilhamfputra31@gmail.com> Date: Fri, 30 Nov 2018 21:00:58 +0700 Subject: [PATCH] fix edit profile bug where user didn't get updated --- app/controllers/Profile.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/Profile.php b/app/controllers/Profile.php index 6e02e77..850ba3a 100644 --- a/app/controllers/Profile.php +++ b/app/controllers/Profile.php @@ -53,7 +53,8 @@ class Profile extends Controller session_start(); if (isset($_COOKIE['access_token'])) { - if ($this->model('Token')->validateToken($_COOKIE['access_token'])) { + $user_id = $this->model('Token')->validateToken($_COOKIE['access_token']); + if ($user_id) { $access_valid = true; } else { $access_valid = false; @@ -77,7 +78,7 @@ class Profile extends Controller } else { $user['userPicture'] = $_POST['avaHidden']; } - + $model = $this->model('User'); if ($model->updateUserById($user)) { $data = $model->readUserById($user['id']); @@ -88,7 +89,6 @@ class Profile extends Controller echo "Internal Server Error"; header('Location: /home'); exit(); - } } else { header('Location: /login'); -- GitLab