Make sure the session is updated after changing current profile

This commit is contained in:
Frederic Guillot 2017-01-03 21:07:34 -05:00
parent f64e74952b
commit 11c5c7a7b7
2 changed files with 14 additions and 0 deletions

View File

@ -32,6 +32,7 @@ Router\post_action('profile', function () {
$new_password = empty($values['password']) ? null : $values['password']; $new_password = empty($values['password']) ? null : $values['password'];
if (Model\User\update_user($user_id, $values['username'], $new_password)) { if (Model\User\update_user($user_id, $values['username'], $new_password)) {
SessionStorage::getInstance()->setFlashMessage(t('Your preferences are updated.')); SessionStorage::getInstance()->setFlashMessage(t('Your preferences are updated.'));
SessionStorage::getInstance()->setUser(Model\User\get_user_by_id($user_id));
} else { } else {
SessionStorage::getInstance()->setFlashErrorMessage(t('Unable to update your preferences.')); SessionStorage::getInstance()->setFlashErrorMessage(t('Unable to update your preferences.'));
} }

View File

@ -45,6 +45,19 @@ class SessionManager
public static function close() public static function close()
{ {
$params = session_get_cookie_params();
setcookie(
session_name(),
'',
time() - 42000,
$params['path'],
$params['domain'],
$params['secure'],
$params['httponly']
);
session_unset();
session_destroy(); session_destroy();
} }
} }