mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-08 09:26:42 +00:00
d133f904d3
Negates the need for a public confirmation resend form since we can instead just send direct to the last session login attempter.
26 lines
580 B
PHP
26 lines
580 B
PHP
<?php
|
|
|
|
namespace BookStack\Access\Controllers;
|
|
|
|
use BookStack\Access\LoginService;
|
|
use BookStack\Exceptions\NotFoundException;
|
|
use BookStack\Users\Models\User;
|
|
|
|
trait HandlesPartialLogins
|
|
{
|
|
/**
|
|
* @throws NotFoundException
|
|
*/
|
|
protected function currentOrLastAttemptedUser(): User
|
|
{
|
|
$loginService = app()->make(LoginService::class);
|
|
$user = auth()->user() ?? $loginService->getLastLoginAttemptUser();
|
|
|
|
if (!$user) {
|
|
throw new NotFoundException(trans('errors.login_user_not_found'));
|
|
}
|
|
|
|
return $user;
|
|
}
|
|
}
|