Browse Source

Close #96 - Set unique page titles

Bubka 3 years ago
parent
commit
98bd9ddea5

+ 1 - 1
resources/js/app.js

@@ -1,9 +1,9 @@
 import Vue              from 'vue'
 import Vue              from 'vue'
 import mixins           from './mixins'
 import mixins           from './mixins'
 import VueStorage       from './packages/vue-storage'
 import VueStorage       from './packages/vue-storage'
+import i18n             from './langs/i18n'
 import router           from './routes'
 import router           from './routes'
 import api              from './api'
 import api              from './api'
-import i18n             from './langs/i18n'
 import FontAwesome      from './packages/fontawesome'
 import FontAwesome      from './packages/fontawesome'
 import Clipboard        from './packages/clipboard'
 import Clipboard        from './packages/clipboard'
 import Notifications    from 'vue-notification'
 import Notifications    from 'vue-notification'

+ 2 - 2
resources/js/components/SettingTabs.vue

@@ -32,11 +32,11 @@
                 	},
                 	},
                 	{
                 	{
                 		'name' : this.$t('settings.oauth'),
                 		'name' : this.$t('settings.oauth'),
-                        'view' : 'settings.oauth'
+                        'view' : 'settings.oauth.tokens'
                 	},
                 	},
                 	{
                 	{
                 		'name' : this.$t('settings.webauthn'),
                 		'name' : this.$t('settings.webauthn'),
-                        'view' : 'settings.webauthn'
+                        'view' : 'settings.webauthn.devices'
                 	},
                 	},
             	]
             	]
             }
             }

+ 6 - 4
resources/js/routes.js

@@ -45,10 +45,10 @@ const router = new Router({
 
 
         { path: '/settings/options', name: 'settings.options', component: SettingsOptions, meta: { requiresAuth: true } },
         { path: '/settings/options', name: 'settings.options', component: SettingsOptions, meta: { requiresAuth: true } },
         { path: '/settings/account', name: 'settings.account', component: SettingsAccount, meta: { requiresAuth: true } },
         { path: '/settings/account', name: 'settings.account', component: SettingsAccount, meta: { requiresAuth: true } },
-        { path: '/settings/oauth', name: 'settings.oauth', component: SettingsOAuth, meta: { requiresAuth: true } },
-        { path: '/settings/webauthn/:credentialId/edit', name: 'settings.webauthn.editCredential', component: EditCredential, meta: { requiresAuth: true }, props: true },
-        { path: '/settings/webauthn', name: 'settings.webauthn', component: SettingsWebAuthn, meta: { requiresAuth: true } },
+        { path: '/settings/oauth', name: 'settings.oauth.tokens', component: SettingsOAuth, meta: { requiresAuth: true } },
         { path: '/settings/oauth/pat/create', name: 'settings.oauth.generatePAT', component: GeneratePAT, meta: { requiresAuth: true } },
         { path: '/settings/oauth/pat/create', name: 'settings.oauth.generatePAT', component: GeneratePAT, meta: { requiresAuth: true } },
+        { path: '/settings/webauthn/:credentialId/edit', name: 'settings.webauthn.editCredential', component: EditCredential, meta: { requiresAuth: true }, props: true },
+        { path: '/settings/webauthn', name: 'settings.webauthn.devices', component: SettingsWebAuthn, meta: { requiresAuth: true } },
 
 
         { path: '/login', name: 'login', component: Login, meta: { disabledWithAuthProxy: true } },
         { path: '/login', name: 'login', component: Login, meta: { disabledWithAuthProxy: true } },
         { path: '/register', name: 'register', component: Register, meta: { disabledWithAuthProxy: true } },
         { path: '/register', name: 'register', component: Register, meta: { disabledWithAuthProxy: true } },
@@ -66,7 +66,9 @@ const router = new Router({
 let isFirstLoad = true;
 let isFirstLoad = true;
 
 
 router.beforeEach((to, from, next) => {
 router.beforeEach((to, from, next) => {
-
+    
+    document.title = router.app.$options.i18n.t('titles.' + to.name)
+    
     if( to.name === 'accounts') {
     if( to.name === 'accounts') {
         to.params.isFirstLoad = isFirstLoad ? true : false
         to.params.isFirstLoad = isFirstLoad ? true : false
         isFirstLoad = false;
         isFirstLoad = false;

+ 2 - 2
resources/js/views/settings/Credentials/Edit.vue

@@ -36,14 +36,14 @@
                 await this.form.patch('/webauthn/credentials/' + this.id + '/name')
                 await this.form.patch('/webauthn/credentials/' + this.id + '/name')
 
 
                 if( this.form.errors.any() === false ) {
                 if( this.form.errors.any() === false ) {
-                    this.$router.push({name: 'settings.webauthn', params: { toRefresh: true }})
+                    this.$router.push({name: 'settings.webauthn.devices', params: { toRefresh: true }})
                 }
                 }
 
 
             },
             },
 
 
             cancelCreation: function() {
             cancelCreation: function() {
 
 
-                this.$router.push({ name: 'settings.webauthn' });
+                this.$router.push({ name: 'settings.webauthn.devices' });
             },
             },
 
 
         },
         },

+ 2 - 2
resources/js/views/settings/PATokens/Create.vue

@@ -34,14 +34,14 @@
                 const { data } = await this.form.post('/oauth/personal-access-tokens')
                 const { data } = await this.form.post('/oauth/personal-access-tokens')
 
 
                 if( this.form.errors.any() === false ) {
                 if( this.form.errors.any() === false ) {
-                    this.$router.push({ name: 'settings.oauth', params: { accessToken: data.accessToken, token_id: data.token.id } });
+                    this.$router.push({ name: 'settings.oauth.tokens', params: { accessToken: data.accessToken, token_id: data.token.id } });
                 }
                 }
 
 
             },
             },
 
 
             cancelGeneration: function() {
             cancelGeneration: function() {
 
 
-                this.$router.push({ name: 'settings.oauth' });
+                this.$router.push({ name: 'settings.oauth.tokens' });
             },
             },
             
             
         },
         },

+ 1 - 1
resources/js/views/settings/WebAuthn.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
     <div>
     <div>
-        <setting-tabs :activeTab="'settings.webauthn'"></setting-tabs>
+        <setting-tabs :activeTab="'settings.webauthn.devices'"></setting-tabs>
         <div class="options-tabs">
         <div class="options-tabs">
             <form-wrapper>
             <form-wrapper>
                 <div v-if="isRemoteUser" class="notification is-warning has-text-centered" v-html="$t('auth.auth_handled_by_proxy')" />
                 <div v-if="isRemoteUser" class="notification is-warning has-text-centered" v-html="$t('auth.auth_handled_by_proxy')" />

+ 47 - 0
resources/lang/en/titles.php

@@ -0,0 +1,47 @@
+<?php
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Titles Language Lines
+    |--------------------------------------------------------------------------
+    |
+    */
+
+    'start' => 'New account',
+    'capture' => 'Flash QR',
+    'accounts' => 'Accounts',
+    'createAccount' => 'Create account',
+    'importAccounts' => 'Import accounts',
+    'editAccount' => 'Account edit',
+    'showQRcode' => 'Account as QR code',
+    'groups' => 'Groups',
+    'createGroup' => 'Create group',
+    'editGroup' => 'Group edit',
+    'settings' => [
+        'options' => 'Options',
+        'account' => 'User account',
+        'oauth' => [
+            'tokens' => 'OAuth tokens',
+            'generatePAT' => 'New personal token',
+        ],
+        'webauthn' => [
+            'editCredential' => 'Device edit',
+            'devices' => 'WebAuthn devices',
+        ],
+    ],
+    'login' => 'Login',
+    'register' => 'Register',
+    'password' => [
+        'request' => 'Reset password',
+        'reset' => 'New password',
+    ],
+    'webauthn' => [
+        'lost' => 'Account recovery',
+        'recover' => 'Register a new device',
+    ],
+    'flooded' => 'Flood',
+    'genericError' => 'Error',
+    '404' => 'Item not found',
+];