From 4ecb3f3b81b4bccc070cdb9ef0b5861bf138d457 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Fri, 25 Oct 2013 11:55:03 +0200 Subject: [PATCH] Fixed updating safety settings --- src/Controllers/UserController.php | 5 ----- src/Models/Model_User.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) 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;