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

@@ -198,9 +198,9 @@ class Auth
* @param bool $long
* @return \Kirby\Cms\User
*
* @throws PermissionException If the rate limit was exceeded or if any other error occured with debug mode off
* @throws NotFoundException If the email was invalid
* @throws InvalidArgumentException If the password is not valid (via `$user->login()`)
* @throws \Kirby\Exception\PermissionException If the rate limit was exceeded or if any other error occured with debug mode off
* @throws \Kirby\Exception\NotFoundException If the email was invalid
* @throws \Kirby\Exception\InvalidArgumentException If the password is not valid (via `$user->login()`)
*/
public function login(string $email, string $password, bool $long = false)
{
@@ -214,10 +214,22 @@ class Auth
$user = $this->validatePassword($email, $password);
$user->loginPasswordless($options);
return $user;
}
/**
* Sets a user object as the current user in the cache
* @internal
*
* @param \Kirby\Cms\User $user
* @return void
*/
public function setUser(User $user): void
{
// stop impersonating
$this->impersonate = null;
return $this->user = $user;
$this->user = $user;
}
/**
@@ -228,9 +240,9 @@ class Auth
* @param string $password
* @return \Kirby\Cms\User
*
* @throws PermissionException If the rate limit was exceeded or if any other error occured with debug mode off
* @throws NotFoundException If the email was invalid
* @throws InvalidArgumentException If the password is not valid (via `$user->login()`)
* @throws \Kirby\Exception\PermissionException If the rate limit was exceeded or if any other error occured with debug mode off
* @throws \Kirby\Exception\NotFoundException If the email was invalid
* @throws \Kirby\Exception\InvalidArgumentException If the password is not valid (via `$user->login()`)
*/
public function validatePassword(string $email, string $password)
{
@@ -334,20 +346,30 @@ class Auth
/**
* Logout the current user
*
* @return bool
* @return void
*/
public function logout(): bool
public function logout(): void
{
// stop impersonating
// stop impersonating;
// ensures that we log out the actually logged in user
$this->impersonate = null;
// logout the current user if it exists
if ($user = $this->user()) {
$user->logout();
}
}
/**
* Clears the cached user data after logout
* @internal
*
* @return void
*/
public function flush(): void
{
$this->impersonate = null;
$this->user = null;
return true;
}
/**
@@ -415,7 +437,8 @@ class Auth
*
* @param \Kirby\Session\Session|array|null $session
* @return \Kirby\Cms\User
* @throws
*
* @throws \Throwable If an authentication error occured
*/
public function user($session = null)
{