mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 02:09:26 +08:00
"See" a user on the initial page load too
This commit is contained in:
parent
9ae5563947
commit
3b4beaa6ca
|
@ -23,8 +23,7 @@ class LoginWithHeader
|
||||||
($accessToken = AccessToken::where('id', $token)->first())) {
|
($accessToken = AccessToken::where('id', $token)->first())) {
|
||||||
$this->actor->setUser($user = $accessToken->user);
|
$this->actor->setUser($user = $accessToken->user);
|
||||||
|
|
||||||
$user->last_seen_time = time();
|
$user->updateLastSeen()->save();
|
||||||
$user->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|
|
@ -404,6 +404,13 @@ class User extends Model
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateLastSeen()
|
||||||
|
{
|
||||||
|
$this->last_seen_time = time();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether or not the user is an administrator.
|
* Check whether or not the user is an administrator.
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,6 +19,8 @@ class LoginWithCookie
|
||||||
if (($token = $request->cookie('flarum_remember')) &&
|
if (($token = $request->cookie('flarum_remember')) &&
|
||||||
($accessToken = AccessToken::where('id', $token)->first())) {
|
($accessToken = AccessToken::where('id', $token)->first())) {
|
||||||
$this->actor->setUser($accessToken->user);
|
$this->actor->setUser($accessToken->user);
|
||||||
|
|
||||||
|
$user->updateLastSeen()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user