mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 18:06:14 +03:00
Merge pull request #1524 from chakflying/fix/disable-auth-icon
Fix: Handle disabled auth in user dropdown
This commit is contained in:
commit
4e28ad4ac2
5 changed files with 16 additions and 5 deletions
|
@ -321,6 +321,8 @@ export default {
|
||||||
// Set it to empty if done
|
// Set it to empty if done
|
||||||
this.saveSettings(() => {
|
this.saveSettings(() => {
|
||||||
this.password.currentPassword = "";
|
this.password.currentPassword = "";
|
||||||
|
this.$root.username = null;
|
||||||
|
this.$root.socket.token = "autoLogin";
|
||||||
}, this.password.currentPassword);
|
}, this.password.currentPassword);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -462,4 +462,6 @@ export default {
|
||||||
"Footer Text": "Footer Text",
|
"Footer Text": "Footer Text",
|
||||||
"Show Powered By": "Show Powered By",
|
"Show Powered By": "Show Powered By",
|
||||||
"Domain Names": "Domain Names",
|
"Domain Names": "Domain Names",
|
||||||
|
signedInDisp: "Signed in as {0}",
|
||||||
|
signedInDispDisabled: "Auth Disabled.",
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,14 +38,19 @@
|
||||||
<font-awesome-icon icon="angle-down" />
|
<font-awesome-icon icon="angle-down" />
|
||||||
</div>
|
</div>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><span class="dropdown-item-text">Signed in as <strong>{{ $root.username }}</strong></span></li>
|
<li>
|
||||||
|
<i18n-t v-if="$root.username != null" tag="span" keypath="signedInDisp" class="dropdown-item-text">
|
||||||
|
<strong>{{ $root.username }}</strong>
|
||||||
|
</i18n-t>
|
||||||
|
<span v-if="$root.username == null" class="dropdown-item-text">{{ $t("signedInDispDisabled") }}</span>
|
||||||
|
</li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li>
|
<li>
|
||||||
<router-link to="/settings" class="dropdown-item" :class="{ active: $route.path.includes('settings') }">
|
<router-link to="/settings" class="dropdown-item" :class="{ active: $route.path.includes('settings') }">
|
||||||
<font-awesome-icon icon="cog" /> {{ $t("Settings") }}
|
<font-awesome-icon icon="cog" /> {{ $t("Settings") }}
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="$root.loggedIn && $root.storage().token !== 'autoLogin'">
|
<li v-if="$root.loggedIn && $root.socket.token !== 'autoLogin'">
|
||||||
<button class="dropdown-item" @click="$root.logout">
|
<button class="dropdown-item" @click="$root.logout">
|
||||||
<font-awesome-icon icon="sign-out-alt" />
|
<font-awesome-icon icon="sign-out-alt" />
|
||||||
{{ $t("Logout") }}
|
{{ $t("Logout") }}
|
||||||
|
@ -230,8 +235,10 @@ main {
|
||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
margin-top: 8px !important;
|
margin-top: 8px !important;
|
||||||
border-radius: 20px;
|
border-radius: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.dropdown-divider {
|
.dropdown-divider {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
|
@ -103,8 +103,8 @@ export default {
|
||||||
|
|
||||||
socket.on("autoLogin", (monitorID, data) => {
|
socket.on("autoLogin", (monitorID, data) => {
|
||||||
this.loggedIn = true;
|
this.loggedIn = true;
|
||||||
this.username = "No Auth";
|
|
||||||
this.storage().token = "autoLogin";
|
this.storage().token = "autoLogin";
|
||||||
|
this.socket.token = "autoLogin";
|
||||||
this.allowLoginDialog = false;
|
this.allowLoginDialog = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
<!-- Logout Button -->
|
<!-- Logout Button -->
|
||||||
<a v-if="$root.isMobile && $root.loggedIn && $root.storage().token !== 'autoLogin'" class="logout" @click.prevent="$root.logout">
|
<a v-if="$root.isMobile && $root.loggedIn && $root.socket.token !== 'autoLogin'" class="logout" @click.prevent="$root.logout">
|
||||||
<div class="menu-item">
|
<div class="menu-item">
|
||||||
<font-awesome-icon icon="sign-out-alt" />
|
<font-awesome-icon icon="sign-out-alt" />
|
||||||
{{ $t("Logout") }}
|
{{ $t("Logout") }}
|
||||||
|
|
Loading…
Reference in a new issue