-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge pull request #167 from Lissy93/FEATURE/guest-access
[FEATURE] Adds support for guest access Fixes #56
- Loading branch information
Showing
16 changed files
with
311 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "Dashy", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"license": "MIT", | ||
"main": "server", | ||
"scripts": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<template> | ||
<div> | ||
<!-- If auth configured, show status text --> | ||
<span class="user-type-note">{{ makeText() }}</span> | ||
<div class="display-options"> | ||
<!-- If user logged in, show logout button --> | ||
<IconLogout | ||
v-if="userType == userStateEnum.loggedIn" | ||
@click="logout()" | ||
v-tooltip="tooltip($t('settings.sign-out-tooltip'))" | ||
class="layout-icon" tabindex="-2" | ||
/> | ||
<!-- If not logged in, and gues mode enabled, show login button --> | ||
<IconLogout | ||
v-if="userType == userStateEnum.guestAccess" | ||
@click="goToLogin()" | ||
v-tooltip="tooltip($t('settings.sign-in-tooltip'))" | ||
class="layout-icon" tabindex="-2" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import router from '@/router'; | ||
import { logout as registerLogout } from '@/utils/Auth'; | ||
import { localStorageKeys, userStateEnum } from '@/utils/defaults'; | ||
import IconLogout from '@/assets/interface-icons/user-logout.svg'; | ||
export default { | ||
name: 'AuthButtons', | ||
components: { | ||
IconLogout, | ||
}, | ||
props: { | ||
userType: Number, | ||
}, | ||
data() { | ||
return { | ||
userStateEnum, | ||
}; | ||
}, | ||
methods: { | ||
logout() { | ||
registerLogout(); | ||
this.$toasted.show(this.$t('login.logout-message')); | ||
setTimeout(() => { | ||
router.push({ path: '/login' }); | ||
}, 500); | ||
}, | ||
goToLogin() { | ||
router.push({ path: '/login' }); | ||
}, | ||
tooltip(content) { | ||
return { content, trigger: 'hover focus', delay: 250 }; | ||
}, | ||
makeText() { | ||
if (this.userType === userStateEnum.loggedIn) { | ||
const username = localStorage[localStorageKeys.USERNAME]; | ||
return this.$t('settings.sign-in-welcome', { username }); | ||
} | ||
if (this.userType === userStateEnum.guestAccess) { | ||
return this.$t('settings.sign-in-tooltip'); | ||
} | ||
return ''; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
@import '@/styles/style-helpers.scss'; | ||
span.user-type-note { | ||
color: var(--settings-text-color); | ||
text-transform: capitalize; | ||
margin-right: 0.5rem; | ||
} | ||
.display-options { | ||
@extend .svg-button; | ||
color: var(--settings-text-color); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.