Disable the logout method for authentication methods other than 'json' (currently 'proxy' and 'none'.)

This commit is contained in:
Ovidiu Predescu 2019-12-03 17:31:11 -08:00
parent 118071ba4b
commit b42b09ccbe
3 changed files with 7 additions and 3 deletions

View File

@ -24,7 +24,7 @@
<span>{{ $t('sidebar.settings') }}</span>
</router-link>
<button v-if="!noAuth" @click="logout" class="action" id="logout" :aria-label="$t('sidebar.logout')" :title="$t('sidebar.logout')">
<button v-if="authMethod == 'json'" @click="logout" class="action" id="logout" :aria-label="$t('sidebar.logout')" :title="$t('sidebar.logout')">
<i class="material-icons">exit_to_app</i>
<span>{{ $t('sidebar.logout') }}</span>
</button>
@ -56,7 +56,7 @@
<script>
import { mapState, mapGetters } from 'vuex'
import * as auth from '@/utils/auth'
import { version, signup, disableExternal, noAuth } from '@/utils/constants'
import { version, signup, disableExternal, noAuth, authMethod } from '@/utils/constants'
export default {
name: 'sidebar',
@ -69,7 +69,8 @@ export default {
signup: () => signup,
version: () => version,
disableExternal: () => disableExternal,
noAuth: () => noAuth
noAuth: () => noAuth,
authMethod: () => authMethod
},
methods: {
help () {

View File

@ -8,6 +8,7 @@ const signup = window.FileBrowser.Signup
const version = window.FileBrowser.Version
const logoURL = `/${staticURL}/img/logo.svg`
const noAuth = window.FileBrowser.NoAuth
const authMethod = window.FileBrowser.AuthMethod
const loginPage = window.FileBrowser.LoginPage
export {
@ -20,5 +21,6 @@ export {
signup,
version,
noAuth,
authMethod,
loginPage
}

View File

@ -34,6 +34,7 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *data, box *
"StaticURL": staticURL,
"Signup": d.settings.Signup,
"NoAuth": d.settings.AuthMethod == auth.MethodNoAuth,
"AuthMethod": d.settings.AuthMethod,
"LoginPage": auther.LoginPage(),
"CSS": false,
"ReCaptcha": false,