feat: implement user authentication system
- Add SessionManager for managing user sessions (singleton pattern) - Add BIPUsersDAO for database authentication - Add LoginDialog component for username/password login - Add UserSelectionDialog component for admin user selection - Support silent login by computer name - Implement main page with navigation to Extractor and Cleaner Database: - Table: dbo_BIPUsers - Fields: UserName, Password, UserType, ComputerNmae UI Flow: 1. Silent login on startup via computer name 2. Show login dialog if silent login fails 3. Display main page with user info and navigation 4. Support logout and re-login
This commit is contained in:
@@ -4,6 +4,8 @@ import type { MySqlConfig, SqlServerConfig } from '../main/types/ipc-api.types'
|
||||
import type { ExtractorInput } from '../main/types/extractor.types'
|
||||
import type { CleanerInput } from '../main/types/cleaner.types'
|
||||
import type { ResolverInput } from '../main/ipc/resolver-handler'
|
||||
import type { LoginRequest } from '../main/ipc/auth-handler'
|
||||
import type { UserInfo } from '../main/types/user.types'
|
||||
|
||||
// Custom APIs for renderer
|
||||
const api = {
|
||||
@@ -32,6 +34,18 @@ const api = {
|
||||
validateFormat: (inputs: string[]) => ipcRenderer.invoke('resolver:validateFormat', inputs)
|
||||
},
|
||||
|
||||
// Authentication service
|
||||
auth: {
|
||||
getComputerName: () => ipcRenderer.invoke('auth:getComputerName'),
|
||||
silentLogin: () => ipcRenderer.invoke('auth:silentLogin'),
|
||||
login: (request: LoginRequest) => ipcRenderer.invoke('auth:login', request),
|
||||
logout: () => ipcRenderer.invoke('auth:logout'),
|
||||
getCurrentUser: () => ipcRenderer.invoke('auth:getCurrentUser'),
|
||||
getAllUsers: () => ipcRenderer.invoke('auth:getAllUsers'),
|
||||
switchUser: (userInfo: UserInfo) => ipcRenderer.invoke('auth:switchUser', userInfo),
|
||||
isAdmin: () => ipcRenderer.invoke('auth:isAdmin')
|
||||
},
|
||||
|
||||
// Database service
|
||||
database: {
|
||||
connectMySql: (config: MySqlConfig) => ipcRenderer.invoke('database:mysql:connect', config),
|
||||
|
||||
Reference in New Issue
Block a user