mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 03:54:17 +02:00
Merge branch 'feature_user_authentication' of https://github.com/cadtoolbox/bambuddy into test-merge
# Conflicts: # frontend/src/components/ConfigureAmsSlotModal.tsx # frontend/src/i18n/locales/ja.ts # static/index.html
This commit is contained in:
@@ -1906,6 +1906,7 @@ export interface LoginResponse {
|
||||
export interface UserResponse {
|
||||
id: number;
|
||||
username: string;
|
||||
email?: string;
|
||||
role: string; // Deprecated, kept for backward compatibility
|
||||
is_active: boolean;
|
||||
is_admin: boolean; // Computed from role and group membership
|
||||
@@ -1916,7 +1917,8 @@ export interface UserResponse {
|
||||
|
||||
export interface UserCreate {
|
||||
username: string;
|
||||
password: string;
|
||||
password?: string; // Optional when advanced auth is enabled
|
||||
email?: string;
|
||||
role: string;
|
||||
group_ids?: number[];
|
||||
}
|
||||
@@ -1924,6 +1926,7 @@ export interface UserCreate {
|
||||
export interface UserUpdate {
|
||||
username?: string;
|
||||
password?: string;
|
||||
email?: string;
|
||||
role?: string;
|
||||
is_active?: boolean;
|
||||
group_ids?: number[];
|
||||
@@ -1935,6 +1938,54 @@ export interface SetupRequest {
|
||||
admin_password?: string;
|
||||
}
|
||||
|
||||
export interface ForgotPasswordRequest {
|
||||
email: string;
|
||||
}
|
||||
|
||||
export interface ForgotPasswordResponse {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface ResetPasswordRequest {
|
||||
user_id: number;
|
||||
}
|
||||
|
||||
export interface ResetPasswordResponse {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface SMTPSettings {
|
||||
smtp_host: string;
|
||||
smtp_port: number;
|
||||
smtp_username?: string;
|
||||
smtp_password?: string;
|
||||
smtp_security: 'starttls' | 'ssl' | 'none';
|
||||
smtp_auth_enabled: boolean;
|
||||
smtp_from_email: string;
|
||||
smtp_from_name: string;
|
||||
}
|
||||
|
||||
export interface TestSMTPRequest {
|
||||
smtp_host: string;
|
||||
smtp_port: number;
|
||||
smtp_username?: string;
|
||||
smtp_password?: string;
|
||||
smtp_security: 'starttls' | 'ssl' | 'none';
|
||||
smtp_auth_enabled: boolean;
|
||||
smtp_from_email: string;
|
||||
test_recipient: string;
|
||||
}
|
||||
|
||||
export interface TestSMTPResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface AdvancedAuthStatus {
|
||||
advanced_auth_enabled: boolean;
|
||||
smtp_configured: boolean;
|
||||
}
|
||||
|
||||
export interface SetupResponse {
|
||||
auth_enabled: boolean;
|
||||
admin_created?: boolean;
|
||||
@@ -1968,6 +2019,38 @@ export const api = {
|
||||
request<{ message: string; auth_enabled: boolean }>('/auth/disable', {
|
||||
method: 'POST',
|
||||
}),
|
||||
|
||||
// Advanced Authentication
|
||||
testSMTP: (data: TestSMTPRequest) =>
|
||||
request<TestSMTPResponse>('/auth/smtp/test', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
}),
|
||||
getSMTPSettings: () => request<SMTPSettings | null>('/auth/smtp'),
|
||||
saveSMTPSettings: (data: SMTPSettings) =>
|
||||
request<{ message: string }>('/auth/smtp', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
}),
|
||||
enableAdvancedAuth: () =>
|
||||
request<{ message: string; advanced_auth_enabled: boolean }>('/auth/advanced-auth/enable', {
|
||||
method: 'POST',
|
||||
}),
|
||||
disableAdvancedAuth: () =>
|
||||
request<{ message: string; advanced_auth_enabled: boolean }>('/auth/advanced-auth/disable', {
|
||||
method: 'POST',
|
||||
}),
|
||||
getAdvancedAuthStatus: () => request<AdvancedAuthStatus>('/auth/advanced-auth/status'),
|
||||
forgotPassword: (data: ForgotPasswordRequest) =>
|
||||
request<ForgotPasswordResponse>('/auth/forgot-password', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
}),
|
||||
resetUserPassword: (data: ResetPasswordRequest) =>
|
||||
request<ResetPasswordResponse>('/auth/reset-password', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
}),
|
||||
|
||||
// Users
|
||||
getUsers: () => request<UserResponse[]>('/users/'),
|
||||
|
||||
Reference in New Issue
Block a user