mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-30 11:10:40 +00:00
show logged in user
This commit is contained in:
parent
c6fc385289
commit
9ad8e5f56a
4 changed files with 31 additions and 0 deletions
|
@ -865,6 +865,27 @@ exports.entryPage = "dashboard";
|
|||
}
|
||||
});
|
||||
|
||||
socket.on("getUsername", async (callback) => {
|
||||
try {
|
||||
checkLogin(socket);
|
||||
|
||||
let user = await R.findOne("user", " id = ? AND active = 1 ", [
|
||||
socket.userID,
|
||||
]);
|
||||
|
||||
callback({
|
||||
ok: true,
|
||||
data: user.username,
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
callback({
|
||||
ok: false,
|
||||
msg: e.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("getSettings", async (callback) => {
|
||||
try {
|
||||
checkLogin(socket);
|
||||
|
|
|
@ -197,4 +197,5 @@ export default {
|
|||
pushbullet: "Pushbullet",
|
||||
line: "Line Messenger",
|
||||
mattermost: "Mattermost",
|
||||
"Current User": "Aktueller Benutzer",
|
||||
};
|
||||
|
|
|
@ -305,4 +305,5 @@ export default {
|
|||
"One record": "One record",
|
||||
"Showing {from} to {to} of {count} records": "Showing {from} to {to} of {count} records",
|
||||
steamApiKeyDescription: "For monitoring a Steam Gameserver you need a steam Web-API key. You can register your api key here: ",
|
||||
"Current User": "Current User",
|
||||
};
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
<!-- Change Password -->
|
||||
<template v-if="! settings.disableAuth">
|
||||
<h2 class="mt-5 mb-2">{{ $t("Change Password") }}</h2>
|
||||
<p>{{ $t("Current User") }}: <strong>{{ this.username }}</strong></p>
|
||||
<form class="mb-3" @submit.prevent="savePassword">
|
||||
<div class="mb-3">
|
||||
<label for="current-password" class="form-label">{{ $t("Current Password") }}</label>
|
||||
|
@ -459,6 +460,7 @@ export default {
|
|||
},
|
||||
|
||||
mounted() {
|
||||
this.loadUsername();
|
||||
this.loadSettings();
|
||||
},
|
||||
|
||||
|
@ -484,6 +486,12 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
loadUsername() {
|
||||
this.$root.getSocket().emit("getUsername", (res) => {
|
||||
this.username = res.data;
|
||||
});
|
||||
},
|
||||
|
||||
loadSettings() {
|
||||
this.$root.getSocket().emit("getSettings", (res) => {
|
||||
this.settings = res.data;
|
||||
|
|
Loading…
Reference in a new issue