diff --git a/komga-webui/src/components/UsersList.vue b/komga-webui/src/components/UsersList.vue
index 98f26e06d..a3c1918da 100644
--- a/komga-webui/src/components/UsersList.vue
+++ b/komga-webui/src/components/UsersList.vue
@@ -2,6 +2,7 @@
{{ u.email }}
+
+ {{
+ $t('settings_user.latest_activity', {
+ date:
+ new Intl.DateTimeFormat($i18n.locale, {
+ dateStyle: 'medium',
+ timeStyle: 'short'
+ }).format(new Date(usersLastActivity[u.id]))
+ })
+ }}
+
+ {{ $t('settings_user.no_recent_activity') }}
@@ -122,6 +135,7 @@ export default Vue.extend({
userToEdit: {} as UserDto,
modalChangePassword: false,
userToChangePassword: {} as UserDto,
+ usersLastActivity: {} as any,
}),
computed: {
users(): UserWithSharedLibrariesDto[] {
@@ -131,6 +145,16 @@ export default Vue.extend({
return this.$store.state.komgaUsers.me
},
},
+ watch: {
+ users(val) {
+ val.forEach((u: UserDto) => {
+ this.$komgaUsers.getLatestAuthenticationActivityForUser(u)
+ .then(value => this.$set(this.usersLastActivity, `${u.id}`, value.dateTime))
+ .catch(e => {
+ })
+ })
+ },
+ },
async mounted() {
await this.$store.dispatch('getAllUsers')
},
diff --git a/komga-webui/src/locales/en.json b/komga-webui/src/locales/en.json
index efc7dbf0a..8c9308639 100644
--- a/komga-webui/src/locales/en.json
+++ b/komga-webui/src/locales/en.json
@@ -4,8 +4,8 @@
"pageText": "{0}-{1} of {2}"
},
"dataIterator": {
- "noResultsText": "No matching records found",
- "loadingText": "Loading items..."
+ "loadingText": "Loading items...",
+ "noResultsText": "No matching records found"
},
"dataTable": {
"itemsPerPageText": "Rows per page:",
@@ -21,6 +21,14 @@
"account_settings": "Account Settings",
"change_password": "change password"
},
+ "authentication_activity": {
+ "datetime": "Date Time",
+ "email": "Email",
+ "error": "Error",
+ "ip": "Ip",
+ "success": "Success",
+ "user_agent": "User Agent"
+ },
"author_roles": {
"colorist": "colorists",
"cover": "cover",
@@ -183,6 +191,7 @@
"pages": "pages",
"pages_n": "No pages | 1 page | {count} pages",
"password": "Password",
+ "pending_tasks": "No pending tasks | 1 pending task | {count} pending tasks",
"publisher": "Publisher",
"read": "Read",
"readlists": "Read Lists",
@@ -192,8 +201,7 @@
"series": "Series",
"tags": "Tags",
"use_filter_panel_to_change_filter": "Use the filter panel to change the active filter",
- "year": "year",
- "pending_tasks": "No pending tasks | 1 pending task | {count} pending tasks"
+ "year": "year"
},
"dashboard": {
"keep_reading": "Keep Reading",
@@ -583,6 +591,8 @@
"change_password": "Change password",
"edit_shared_libraries": "Edit shared libraries",
"edit_user": "Edit user",
+ "latest_activity": "Latest activity: {date}",
+ "no_recent_activity": "No recent activity",
"role_administrator": "Administrator",
"role_user": "User"
},
@@ -609,20 +619,12 @@
"USER": "User"
},
"users": {
- "users": "Users",
- "authentication_activity": "Authentication Activity"
+ "authentication_activity": "Authentication Activity",
+ "users": "Users"
},
"welcome": {
"add_library": "Add library",
"no_libraries_yet": "No libraries have been added yet!",
"welcome_message": "Welcome to Komga"
- },
- "authentication_activity": {
- "ip": "Ip",
- "user_agent": "User Agent",
- "email": "Email",
- "success": "Success",
- "error": "Error",
- "datetime": "Date Time"
}
}
diff --git a/komga-webui/src/services/komga-users.service.ts b/komga-webui/src/services/komga-users.service.ts
index 33c6aa857..bf2becb6e 100644
--- a/komga-webui/src/services/komga-users.service.ts
+++ b/komga-webui/src/services/komga-users.service.ts
@@ -161,4 +161,16 @@ export default class KomgaUsersService {
throw new Error(msg)
}
}
+
+ async getLatestAuthenticationActivityForUser(user: UserDto): Promise {
+ try {
+ return (await this.http.get(`${API_USERS}/${user.id}/authentication-activity/latest`)).data
+ } catch (e) {
+ let msg = `An error occurred while trying to retrieve latest authentication activity for user ${user.email}`
+ if (e.response.data.message) {
+ msg += `: ${e.response.data.message}`
+ }
+ throw new Error(msg)
+ }
+ }
}