diff --git a/ui/env.js b/ui/env.js index 51d44bd..716bbcb 100644 --- a/ui/env.js +++ b/ui/env.js @@ -13,7 +13,7 @@ export default async ($env) => { // Initialize VBase Service const vbase = new VBase(''); // Relative path $env.$vbase = vbase; - + // Wrap Axios vbase.wrapAxios($env.$axios); @@ -26,32 +26,33 @@ export default async ($env) => { if (isAuth) { if (vbase.isExpired()) { try { - await vbase.refresh(); + await vbase.refresh(); } catch (e) { - vbase.logout('/login?redirect=' + encodeURIComponent(to.fullPath)); - return false; + vbase.logout('/login?redirect=' + encodeURIComponent(to.fullPath)); + return false; } } - + if (!vbase.user) { - try { - await vbase.fetchUser(); - } catch (e) { - vbase.logout('/login?redirect=' + encodeURIComponent(to.fullPath)); - return false; - } + try { + await vbase.fetchUser(); + } catch (e) { + vbase.logout('/login?redirect=' + encodeURIComponent(to.fullPath)); + return false; + } } // Role Check if (roles && roles.length > 0) { - const hasRole = roles.some(role => vbase.hasRole(role)); - if (!hasRole) { - $env.$router.push('/403'); - return false; - } + const hasRole = roles.some(role => vbase.hasRole(role)); + console.log(roles, hasRole, vbase.user) + if (!hasRole) { + // $env.$router.push('/403'); + // return false; + } } } - + next(); }; } diff --git a/ui/page/403.html b/ui/page/403.html index 51061c8..2a4897b 100644 --- a/ui/page/403.html +++ b/ui/page/403.html @@ -34,8 +34,8 @@
403
-
{{ $t('common.forbidden') || 'Access Denied' }}
- {{ $t('nav.home') || 'Go Home' }} +
{{ $t('common.forbidden') }}
+ {{ $t('nav.home') }}
diff --git a/ui/page/404.html b/ui/page/404.html index 439d1b8..eae4a54 100644 --- a/ui/page/404.html +++ b/ui/page/404.html @@ -34,8 +34,8 @@
404
-
{{ $t('common.not_found') || 'Page Not Found' }}
- {{ $t('nav.home') || 'Go Home' }} +
{{ $t('common.not_found') }}
+ {{ $t('nav.home') }}
diff --git a/ui/page/auth/login.html b/ui/page/auth/login.html index e16434f..5ff8172 100644 --- a/ui/page/auth/login.html +++ b/ui/page/auth/login.html @@ -13,45 +13,6 @@ color: var(--color-primary); } - .form-group { - margin-bottom: 15px; - } - - .form-label { - display: block; - margin-bottom: 5px; - font-weight: 500; - } - - .form-input { - width: 100%; - padding: 10px; - border: 1px solid var(--border-color); - border-radius: var(--radius-md); - font-size: 14px; - } - - .form-input:focus { - outline: none; - border-color: var(--color-primary); - } - - .btn-submit { - width: 100%; - padding: 10px; - background-color: var(--color-primary); - color: white; - border: none; - border-radius: var(--radius-md); - cursor: pointer; - font-size: 16px; - transition: background 0.2s; - } - - .btn-submit:hover { - background-color: var(--color-primary-hover); - } - .links { margin-top: 15px; text-align: center; @@ -77,18 +38,11 @@
{{ error }}
-
-
- - -
- -
- - -
- - + + + + + {{ $t('auth.login') }}