mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-18 19:06:45 +02:00
Update the About view and its controller to split user & admin vars
This commit is contained in:
parent
6b6ad12bb7
commit
fd6941d300
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|||||||
use App\Facades\Settings;
|
use App\Facades\Settings;
|
||||||
use App\Services\ReleaseRadarService;
|
use App\Services\ReleaseRadarService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class SystemController extends Controller
|
class SystemController extends Controller
|
||||||
@ -17,33 +18,42 @@ class SystemController extends Controller
|
|||||||
public function infos(Request $request)
|
public function infos(Request $request)
|
||||||
{
|
{
|
||||||
$infos = [];
|
$infos = [];
|
||||||
$infos['Date'] = date(DATE_RFC2822);
|
$infos['common']['Date'] = date(DATE_RFC2822);
|
||||||
$infos['userAgent'] = $request->header('user-agent');
|
$infos['common']['userAgent'] = $request->header('user-agent');
|
||||||
// App info
|
// App info
|
||||||
$infos['Version'] = config('2fauth.version');
|
$infos['common']['Version'] = config('2fauth.version');
|
||||||
$infos['Environment'] = config('app.env');
|
$infos['common']['Environment'] = config('app.env');
|
||||||
$infos['Debug'] = var_export(config('app.debug'), true);
|
$infos['common']['Install path'] = '/' . config('2fauth.config.appSubdirectory');
|
||||||
$infos['Cache driver'] = config('cache.default');
|
$infos['common']['Debug'] = var_export(config('app.debug'), true);
|
||||||
$infos['Log channel'] = config('logging.default');
|
$infos['common']['Cache driver'] = config('cache.default');
|
||||||
$infos['Log level'] = env('LOG_LEVEL');
|
$infos['common']['Log channel'] = config('logging.default');
|
||||||
$infos['DB driver'] = DB::getDriverName();
|
$infos['common']['Log level'] = env('LOG_LEVEL');
|
||||||
|
$infos['common']['DB driver'] = DB::getDriverName();
|
||||||
// PHP info
|
// PHP info
|
||||||
$infos['PHP version'] = PHP_VERSION;
|
$infos['common']['PHP version'] = PHP_VERSION;
|
||||||
$infos['Operating system'] = PHP_OS;
|
$infos['common']['Operating system'] = PHP_OS;
|
||||||
$infos['interface'] = PHP_SAPI;
|
$infos['common']['interface'] = PHP_SAPI;
|
||||||
// Auth info
|
// Auth & Security infos
|
||||||
if ($request->user()) {
|
if (! is_null($request->user())) {
|
||||||
$infos['Auth guard'] = config('auth.defaults.guard');
|
$infos['common']['Auth guard'] = config('auth.defaults.guard');
|
||||||
if ($infos['Auth guard'] === 'reverse-proxy-guard') {
|
if ($infos['common']['Auth guard'] === 'reverse-proxy-guard') {
|
||||||
$infos['Auth proxy header for user'] = config('auth.auth_proxy_headers.user');
|
$infos['common']['Auth proxy logout url'] = config('2fauth.config.proxyLogoutUrl');
|
||||||
$infos['Auth proxy header for email'] = config('auth.auth_proxy_headers.email');
|
$infos['common']['Auth proxy header for user'] = config('auth.auth_proxy_headers.user');
|
||||||
|
$infos['common']['Auth proxy header for email'] = config('auth.auth_proxy_headers.email');
|
||||||
|
}
|
||||||
|
$infos['common']['webauthn user verification'] = config('webauthn.user_verification');
|
||||||
|
$infos['common']['Trusted proxies'] = config('2fauth.config.trustedProxies') ?: 'none';
|
||||||
|
|
||||||
|
// Admin settings
|
||||||
|
if ($request->user()->is_admin == true) {
|
||||||
|
$infos['admin_settings']['useEncryption'] = Settings::get('useEncryption');
|
||||||
|
$infos['admin_settings']['lastRadarScan'] = Carbon::parse(Settings::get('lastRadarScan'))->format('Y-m-d H:i:s');
|
||||||
|
$infos['admin_settings']['checkForUpdate'] = Settings::get('CheckForUpdate');
|
||||||
}
|
}
|
||||||
$infos['webauthn user verification'] = config('larapass.login_verify');
|
|
||||||
$infos['Trusted proxies'] = config('2fauth.trustedProxies') ?: 'none';
|
|
||||||
}
|
}
|
||||||
// User info
|
// User info
|
||||||
if ($request->user()) {
|
if ($request->user()) {
|
||||||
$infos['options'] = Settings::all()->toArray();
|
$infos['user_preferences'] = $request->user()->preferences->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($infos);
|
return response()->json($infos);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
{{ $t('commons.2fauth_teaser')}}
|
{{ $t('commons.2fauth_teaser')}}
|
||||||
</p>
|
</p>
|
||||||
<img class="about-logo" src="logo.svg" alt="2FAuth logo" />
|
<img class="about-logo" src="logo.svg" alt="2FAuth logo" />
|
||||||
<p class="block" :class="showUserOptions ? 'mb-5' : '' ">
|
<p class="block">
|
||||||
©Bubka <a class="is-size-7" href="https://github.com/Bubka/2FAuth/blob/master/LICENSE">AGPL-3.0 license</a>
|
©Bubka <a class="is-size-7" href="https://github.com/Bubka/2FAuth/blob/master/LICENSE">AGPL-3.0 license</a>
|
||||||
</p>
|
</p>
|
||||||
<h2 class="title is-5 has-text-grey-light">
|
<h2 class="title is-5 has-text-grey-light">
|
||||||
@ -59,18 +59,27 @@
|
|||||||
<li v-for="(value, key) in infos" :value="value" :key="key"><b>{{key}}</b>: {{value}}</li>
|
<li v-for="(value, key) in infos" :value="value" :key="key"><b>{{key}}</b>: {{value}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showUserOptions">
|
<h2 v-if="showAdminSettings" class="title is-5 has-text-grey-light">
|
||||||
<h2 class="title is-5 has-text-grey-light">
|
{{ $t('settings.admin_settings') }}
|
||||||
{{ $t('settings.user_options') }}
|
</h2>
|
||||||
</h2>
|
<div v-if="showAdminSettings" class="about-debug box is-family-monospace is-size-7">
|
||||||
<div class="about-debug box is-family-monospace is-size-7">
|
<button :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" v-clipboard="() => this.$refs.listAdminSettings.innerText" v-clipboard:success="clipboardSuccessHandler">
|
||||||
<button :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" v-clipboard="() => this.$refs.listUserOptions.innerText" v-clipboard:success="clipboardSuccessHandler">
|
<font-awesome-icon :icon="['fas', 'copy']" />
|
||||||
<font-awesome-icon :icon="['fas', 'copy']" />
|
</button>
|
||||||
</button>
|
<ul ref="listAdminSettings">
|
||||||
<ul ref="listUserOptions">
|
<li v-for="(value, setting) in adminSettings" :value="value" :key="setting"><b>{{setting}}</b>: {{value}}</li>
|
||||||
<li v-for="(value, option) in options" :value="value" :key="option"><b>{{option}}</b>: {{value}}</li>
|
</ul>
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
<h2 v-if="showUserPreferences" class="title is-5 has-text-grey-light">
|
||||||
|
{{ $t('settings.user_preferences') }}
|
||||||
|
</h2>
|
||||||
|
<div v-if="showUserPreferences" class="about-debug box is-family-monospace is-size-7">
|
||||||
|
<button :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" v-clipboard="() => this.$refs.listUserPreferences.innerText" v-clipboard:success="clipboardSuccessHandler">
|
||||||
|
<font-awesome-icon :icon="['fas', 'copy']" />
|
||||||
|
</button>
|
||||||
|
<ul ref="listUserPreferences">
|
||||||
|
<li v-for="(value, preference) in userPreferences" :value="value" :key="preference"><b>{{preference}}</b>: {{value}}</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
<vue-footer :showButtons="true">
|
<vue-footer :showButtons="true">
|
||||||
@ -88,19 +97,25 @@
|
|||||||
return {
|
return {
|
||||||
pagetitle: this.$t('commons.about'),
|
pagetitle: this.$t('commons.about'),
|
||||||
infos : null,
|
infos : null,
|
||||||
options : null,
|
adminSettings : null,
|
||||||
showUserOptions: false,
|
userPreferences : null,
|
||||||
|
showUserPreferences: false,
|
||||||
|
showAdminSettings: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.axios.get('infos').then(response => {
|
await this.axios.get('infos').then(response => {
|
||||||
this.infos = response.data
|
this.infos = response.data.common
|
||||||
|
|
||||||
if (response.data.options) {
|
if (response.data.admin_settings) {
|
||||||
this.options = response.data.options
|
this.adminSettings = response.data.admin_settings
|
||||||
delete this.infos.options
|
this.showAdminSettings = true
|
||||||
this.showUserOptions = true
|
}
|
||||||
|
|
||||||
|
if (response.data.user_preferences) {
|
||||||
|
this.userPreferences = response.data.user_preferences
|
||||||
|
this.showUserPreferences = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,8 @@ return [
|
|||||||
'webauthn' => 'WebAuthn',
|
'webauthn' => 'WebAuthn',
|
||||||
'tokens' => 'Tokens',
|
'tokens' => 'Tokens',
|
||||||
'options' => 'Options',
|
'options' => 'Options',
|
||||||
'user_options' => 'User options',
|
'user_preferences' => 'User preferences',
|
||||||
|
'admin_settings' => 'Admin settings',
|
||||||
'confirm' => [
|
'confirm' => [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user