Closed #52 - fixes for anonymous accounts

- Anonymous account is no longer created when commenting/uploading
- Anonymous users can now switch safety, if it's available
- Anonymous users can delete their own posts
- Refurbished session and logging in/out mechanism
- Possible fixes for registration/activation/account deletion issues
This commit is contained in:
Marcin Kurczewski
2013-10-27 20:39:32 +01:00
parent f726690ea3
commit b55a8f1dce
10 changed files with 75 additions and 67 deletions

View File

@ -209,6 +209,8 @@ class UserController
R::store($post);
}
$user->ownFavoritee = [];
if ($user->id == $this->context->user->id)
AuthController::doLogOut();
R::store($user);
R::trash($user);
\Chibi\UrlHelper::forward(\Chibi\UrlHelper::route('index', 'index'));
@ -247,7 +249,7 @@ class UserController
$user->enableEndlessScrolling(InputHelper::get('endless-scrolling'));
R::store($user);
$this->context->transport->user = $user;
AuthController::doReLog();
$this->context->transport->success = true;
}
}
@ -453,7 +455,9 @@ class UserController
$this->context->user->enableSafety($safety,
!$this->context->user->hasEnabledSafety($safety));
R::store($this->context->user);
AuthController::doReLog();
if (!$this->context->user->anonymous)
R::store($this->context->user);
$this->context->transport->success = true;
}
@ -535,8 +539,8 @@ class UserController
if (!$this->config->registration->needEmailForRegistering and !$this->config->registration->staffActivation)
{
$_SESSION['user-id'] = $dbUser->id;
\Chibi\Registry::getBootstrap()->attachUser();
$this->context->user = $dbUser;
AuthController::doReLog();
}
}
}
@ -567,8 +571,8 @@ class UserController
if (!$this->config->registration->staffActivation)
{
$_SESSION['user-id'] = $dbUser->id;
\Chibi\Registry::getBootstrap()->attachUser();
$this->context->user = $dbUser;
AuthController::doReLog();
}
}
}