mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #5615 from turbo124/v5-develop
Minor fixes for password protection cache
This commit is contained in:
commit
9ec47e09b2
@ -194,8 +194,8 @@ class LoginController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user->setCompany($user->account->default_company);
|
$user->setCompany($user->account->default_company);
|
||||||
$timeout = auth()->user()->company()->default_password_timeout / 60000;
|
$timeout = $user->company()->default_password_timeout / 60000;
|
||||||
Cache::put(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout);
|
Cache::put($user->hashed_id.'_logged_in', Str::random(64), $timeout);
|
||||||
|
|
||||||
$cu = CompanyUser::query()
|
$cu = CompanyUser::query()
|
||||||
->where('user_id', auth()->user()->id);
|
->where('user_id', auth()->user()->id);
|
||||||
|
@ -46,8 +46,7 @@ class PasswordProtection
|
|||||||
|
|
||||||
if (Cache::get(auth()->user()->hashed_id.'_logged_in')) {
|
if (Cache::get(auth()->user()->hashed_id.'_logged_in')) {
|
||||||
|
|
||||||
Cache::pull(auth()->user()->hashed_id.'_logged_in');
|
Cache::put(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout);
|
||||||
Cache::add(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout);
|
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class UpdateUserRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->id === $this->id || auth()->user()->isAdmin();
|
return auth()->user()->id == $this->user->id || auth()->user()->isAdmin();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user