diff --git a/src/Controllers/UserController.php b/src/Controllers/UserController.php index 4f48808c..3a10e7bc 100644 --- a/src/Controllers/UserController.php +++ b/src/Controllers/UserController.php @@ -245,11 +245,6 @@ class UserController R::store($user); $this->context->transport->user = $user; - if ($this->context->user->id == $user->id) - { - $this->context->user = $user; - unset($_SESSION['user']); - } $this->context->transport->success = true; } } diff --git a/src/Models/Model_User.php b/src/Models/Model_User.php index dc5477a1..2a810152 100644 --- a/src/Models/Model_User.php +++ b/src/Models/Model_User.php @@ -41,6 +41,16 @@ class Model_User extends RedBean_SimpleModel $this->settings = $settings; } + public function update() + { + $context = \Chibi\Registry::getContext(); + if ($context->user->id == $this->id) + { + $context->user = $this; + unset($_SESSION['user']); + } + } + const SETTING_SAFETY = 1;