diff --git a/komga-webui/src/components/AuthenticationActivityTable.vue b/komga-webui/src/components/AuthenticationActivityTable.vue new file mode 100644 index 0000000000..d31895845f --- /dev/null +++ b/komga-webui/src/components/AuthenticationActivityTable.vue @@ -0,0 +1,103 @@ + + + diff --git a/komga-webui/src/components/UsersList.vue b/komga-webui/src/components/UsersList.vue new file mode 100644 index 0000000000..29848f7b29 --- /dev/null +++ b/komga-webui/src/components/UsersList.vue @@ -0,0 +1,138 @@ + + + + + diff --git a/komga-webui/src/locales/en.json b/komga-webui/src/locales/en.json index fc8f3dc442..8f53454ac4 100644 --- a/komga-webui/src/locales/en.json +++ b/komga-webui/src/locales/en.json @@ -3,6 +3,10 @@ "dataFooter": { "pageText": "{0}-{1} of {2}" }, + "dataIterator": { + "noResultsText": "No matching records found", + "loadingText": "Loading items..." + }, "dataTable": { "itemsPerPageText": "Rows per page:", "sortBy": "Sort by" @@ -604,11 +608,20 @@ "USER": "User" }, "users": { - "users": "Users" + "users": "Users", + "authentication_activity": "Authentication Activity" }, "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 a76dac55ec..c43c2a408a 100644 --- a/komga-webui/src/services/komga-users.service.ts +++ b/komga-webui/src/services/komga-users.service.ts @@ -1,4 +1,6 @@ -import { AxiosInstance } from 'axios' +import {AxiosInstance} from 'axios' + +const qs = require('qs') const API_USERS = '/api/v1/users' @@ -129,4 +131,34 @@ export default class KomgaUsersService { throw new Error(msg) } } + + async getMyAuthenticationActivity (pageRequest?: PageRequest): Promise> { + try { + return (await this.http.get(`${API_USERS}/me/authentication-activity`, { + params: pageRequest, + paramsSerializer: params => qs.stringify(params, { indices: false }), + })).data + } catch (e) { + let msg = 'An error occurred while trying to retrieve authentication activity' + if (e.response.data.message) { + msg += `: ${e.response.data.message}` + } + throw new Error(msg) + } + } + + async getAuthenticationActivity (pageRequest?: PageRequest): Promise> { + try { + return (await this.http.get(`${API_USERS}/authentication-activity`, { + params: pageRequest, + paramsSerializer: params => qs.stringify(params, { indices: false }), + })).data + } catch (e) { + let msg = 'An error occurred while trying to retrieve authentication activity' + if (e.response.data.message) { + msg += `: ${e.response.data.message}` + } + throw new Error(msg) + } + } } diff --git a/komga-webui/src/types/komga-users.ts b/komga-webui/src/types/komga-users.ts index 48e842988d..7fbe8f3937 100644 --- a/komga-webui/src/types/komga-users.ts +++ b/komga-webui/src/types/komga-users.ts @@ -33,3 +33,13 @@ interface SharedLibrariesUpdateDto { interface RolesUpdateDto { roles: string[] } + +interface AuthenticationActivityDto { + userId?: string, + email?: string, + ip?: string, + userAgent?: string, + success: Boolean, + error?: string, + dateTime: string, +} diff --git a/komga-webui/src/views/AccountSettings.vue b/komga-webui/src/views/AccountSettings.vue index c59cd0c6a6..82e594b416 100644 --- a/komga-webui/src/views/AccountSettings.vue +++ b/komga-webui/src/views/AccountSettings.vue @@ -1,8 +1,9 @@