mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-22 13:20:51 +01:00
Add a user attribute to identify authentication by proxy
This commit is contained in:
parent
d629ed83c5
commit
189f02ae9e
@ -3,6 +3,7 @@
|
||||
namespace App\Api\v1\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
/**
|
||||
* @property mixed $id
|
||||
@ -23,12 +24,13 @@ class UserResource extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'oauth_provider' => $this->oauth_provider,
|
||||
'preferences' => $this->preferences,
|
||||
'is_admin' => $this->is_admin,
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'oauth_provider' => $this->oauth_provider,
|
||||
'authenticated_by_proxy' => Auth::getDefaultDriver() === 'reverse-proxy-guard',
|
||||
'preferences' => $this->preferences,
|
||||
'is_admin' => $this->is_admin,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
1
resources/js/router/middlewares/authGuard.js
vendored
1
resources/js/router/middlewares/authGuard.js
vendored
@ -13,6 +13,7 @@ export default async function authGuard({ to, next, nextMiddleware, stores }) {
|
||||
name: currentUser.name,
|
||||
email: currentUser.email,
|
||||
oauth_provider: currentUser.oauth_provider,
|
||||
authenticated_by_proxy: currentUser.authenticated_by_proxy,
|
||||
preferences: currentUser.preferences,
|
||||
isAdmin: currentUser.is_admin,
|
||||
})
|
||||
|
1
resources/js/stores/user.js
vendored
1
resources/js/stores/user.js
vendored
@ -16,6 +16,7 @@ export const useUserStore = defineStore({
|
||||
name: undefined,
|
||||
email: undefined,
|
||||
oauth_provider: undefined,
|
||||
authenticated_by_proxy: undefined,
|
||||
preferences: window.defaultPreferences,
|
||||
isAdmin: false,
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
name: response.data.name,
|
||||
email: response.data.email,
|
||||
oauth_provider: response.data.oauth_provider,
|
||||
authenticated_by_proxy: false,
|
||||
preferences: response.data.preferences,
|
||||
isAdmin: response.data.is_admin,
|
||||
})
|
||||
@ -67,6 +68,7 @@
|
||||
name: response.data.name,
|
||||
email: response.data.email,
|
||||
oauth_provider: response.data.oauth_provider,
|
||||
authenticated_by_proxy: false,
|
||||
preferences: response.data.preferences,
|
||||
isAdmin: response.data.is_admin,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user