🌐 Adds translations for Guest Access

This commit is contained in:
Alicia Sykes 2021-08-18 21:52:47 +01:00
parent a95c91a380
commit edf941229c
3 changed files with 26 additions and 11 deletions

View File

@ -23,7 +23,12 @@
"error-incorrect-username": "User not found", "error-incorrect-username": "User not found",
"error-incorrect-password": "Incorrect Password", "error-incorrect-password": "Incorrect Password",
"success-message": "Logging in...", "success-message": "Logging in...",
"logout-message": "Logged Out" "logout-message": "Logged Out",
"already-logged-in-title": "Already Logged In",
"already-logged-in-text": "You're logged in as",
"proceed-to-dashboard": "Proceed to Dashboard",
"log-out-button": "Logout",
"proceed-guest-button": "Proceed as Guest"
}, },
"config": { "config": {
"main-tab": "Main Menu", "main-tab": "Main Menu",
@ -67,7 +72,9 @@
"item-size-large": "Large", "item-size-large": "Large",
"config-launcher-label": "Config", "config-launcher-label": "Config",
"config-launcher-tooltip": "Update Configuration", "config-launcher-tooltip": "Update Configuration",
"sign-out-tooltip": "Sign Out" "sign-out-tooltip": "Sign Out",
"sign-in-tooltip": "Log In",
"sign-in-welcome": "Hello {username}!"
}, },
"updates": { "updates": {
"app-version-note": "Dashy version", "app-version-note": "Dashy version",
@ -154,4 +161,4 @@
"modal": "Open in Pop-Up Modal", "modal": "Open in Pop-Up Modal",
"workspace": "Open in Workspace View" "workspace": "Open in Workspace View"
} }
} }

View File

@ -14,7 +14,7 @@
<IconLogout <IconLogout
v-if="userType == userStateEnum.guestAccess" v-if="userType == userStateEnum.guestAccess"
@click="goToLogin()" @click="goToLogin()"
v-tooltip="tooltip('Login')" v-tooltip="tooltip($t('settings.sign-in-tooltip'))"
class="layout-icon" tabindex="-2" class="layout-icon" tabindex="-2"
/> />
</div> </div>
@ -55,8 +55,13 @@ export default {
return { content, trigger: 'hover focus', delay: 250 }; return { content, trigger: 'hover focus', delay: 250 };
}, },
makeText() { makeText() {
if (this.userType === userStateEnum.loggedIn) return `Hello ${localStorage[localStorageKeys.USERNAME]}!`; if (this.userType === userStateEnum.loggedIn) {
if (this.userType === userStateEnum.guestAccess) return 'Log In'; 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 ''; return '';
}, },
}, },

View File

@ -2,12 +2,15 @@
<div class="login-page"> <div class="login-page">
<!-- User is already logged in --> <!-- User is already logged in -->
<div v-if="isUserAlreadyLoggedIn" class="already-logged-in"> <div v-if="isUserAlreadyLoggedIn" class="already-logged-in">
<h2>Already Logged In</h2> <h2>{{ $t('login.already-logged-in-title') }}</h2>
<p class="already-logged-in"> <p class="already-logged-in">
You're logged in as <span class="username">{{ existingUsername }}</span> {{ $t('login.already-logged-in-text') }}
<span class="username">{{ existingUsername }}</span>
</p> </p>
<Button class="login-button" :click="stayLoggedIn">Proceed to Dashboard</Button> <Button class="login-button" :click="stayLoggedIn">
<Button class="login-button" :click="getOut">Logout</Button> {{ $t('login.proceed-to-dashboard') }}
</Button>
<Button class="login-button" :click="getOut">{{ $t('login.log-out-button') }}</Button>
<span class="already-logged-in-note"> <span class="already-logged-in-note">
You need to log out, in order to proceed as a different user. You need to log out, in order to proceed as a different user.
</span> </span>
@ -49,7 +52,7 @@
v-if="appConfig.enableGuestAccess && !isUserAlreadyLoggedIn && isAuthenticationEnabled"> v-if="appConfig.enableGuestAccess && !isUserAlreadyLoggedIn && isAuthenticationEnabled">
<h2 class="login-title">Guest Access</h2> <h2 class="login-title">Guest Access</h2>
<Button class="login-button" :click="guestLogin"> <Button class="login-button" :click="guestLogin">
Proceed as Guest {{ $t('login.proceed-guest-button') }}
</Button> </Button>
<p class="guest-intro"> <p class="guest-intro">
This instance has guest access enabled.<br> This instance has guest access enabled.<br>