Upgrade to 3.3.1

This commit is contained in:
Bastian Allgeier
2019-11-26 11:04:08 +01:00
parent 23c67beafb
commit 3a82406bed
156 changed files with 437 additions and 121 deletions

View File

@@ -5,7 +5,6 @@ namespace Kirby\Cms;
use Exception;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Exception\NotFoundException;
use Kirby\Exception\PermissionException;
use Kirby\Session\Session;
use Kirby\Toolkit\F;
use Kirby\Toolkit\Str;
@@ -408,7 +407,7 @@ class User extends ModelWithContent
* @param \Kirby\Session\Session|array $session Session options or session object to set the user in
* @return bool
*
* @throws PermissionException If the password is not valid
* @throws \Kirby\Exception\PermissionException If the password is not valid
*/
public function login(string $password, $session = null): bool
{
@@ -434,6 +433,7 @@ class User extends ModelWithContent
$session->regenerateToken(); // privilege change
$session->data()->set('user.id', $this->id());
$this->kirby()->auth()->setUser($this);
$kirby->trigger('user.login:after', $this, $session);
}
@@ -451,8 +451,12 @@ class User extends ModelWithContent
$kirby->trigger('user.logout:before', $this, $session);
// remove the user from the session for future requests
$session->data()->remove('user.id');
// clear the cached user object from the app state of the current request
$this->kirby()->auth()->flush();
if ($session->data()->get() === []) {
// session is now empty, we might as well destroy it
$session->destroy();
@@ -872,9 +876,9 @@ class User extends ModelWithContent
* @param string $password
* @return bool
*
* @throws NotFoundException If the user has no password
* @throws InvalidArgumentException If the entered password is not valid
* @throws InvalidArgumentException If the entered password does not match the user password
* @throws \Kirby\Exception\NotFoundException If the user has no password
* @throws \Kirby\Exception\InvalidArgumentException If the entered password is not valid
* @throws \Kirby\Exception\InvalidArgumentException If the entered password does not match the user password
*/
public function validatePassword(string $password = null): bool
{