- MySettingsPage: timezone, password change (local users), MFA setup/disable - Password change hidden for federated users (auth_provider != local) - Federated users see info message: "managed by Oracle IAM" - Backend: auth_provider + oidc_subject columns in users table (migration) - /users/me returns auth_provider field - User interface updated with auth_provider - i18n: 12 new keys (pt/en) for password change
34 lines
838 B
TypeScript
34 lines
838 B
TypeScript
import client from '../client';
|
|
|
|
export interface User {
|
|
id: string;
|
|
username: string;
|
|
role: string;
|
|
first_name?: string;
|
|
last_name?: string;
|
|
email?: string;
|
|
mfa_enabled?: boolean;
|
|
timezone?: string;
|
|
auth_provider?: string;
|
|
}
|
|
|
|
export interface LoginResponse {
|
|
token?: string;
|
|
user?: User;
|
|
mfa_required?: boolean;
|
|
mfa_setup?: boolean;
|
|
totp_uri?: string;
|
|
}
|
|
|
|
export const authApi = {
|
|
login: (username: string, password: string, totp_code?: string) =>
|
|
client.post<never, LoginResponse>('/auth/login', { username, password, ...(totp_code && { totp_code }) }),
|
|
|
|
logout: () => client.post('/auth/logout'),
|
|
|
|
me: () => client.get<never, User>('/users/me'),
|
|
|
|
changePassword: (current_password: string, new_password: string) =>
|
|
client.post('/auth/change-password', { current_password, new_password }),
|
|
};
|