@djangocfg/api 2.1.263 → 2.1.264
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.cjs +49 -72
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +49 -72
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +57 -79
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +113 -179
- package/dist/clients.d.ts +113 -179
- package/dist/clients.mjs +57 -79
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.d.cts +72 -72
- package/dist/hooks.d.ts +72 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +97 -97
- package/dist/index.d.ts +97 -97
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/cfg_accounts/accounts/models.ts +31 -31
- package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +40 -40
- package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +31 -31
- package/src/_api/generated/cfg_totp/CLAUDE.md +3 -3
- package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +7 -7
- package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +5 -5
- package/src/_api/generated/cfg_totp/_utils/schemas/index.ts +0 -1
- package/src/_api/generated/cfg_totp/schema.json +2 -103
- package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +14 -14
- package/src/_api/generated/cfg_totp/totp__totp_management/client.ts +2 -13
- package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +4 -29
- package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +13 -13
- package/src/auth/hooks/useTwoFactorStatus.ts +5 -11
- package/src/_api/generated/cfg_totp/_utils/schemas/PaginatedDeviceListResponseList.schema.ts +0 -24
|
@@ -68,13 +68,10 @@ export const useTwoFactorStatus = (): UseTwoFactorStatusReturn => {
|
|
|
68
68
|
try {
|
|
69
69
|
authLogger.info('Fetching 2FA status...');
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
// API returns { devices: [...], has_2fa_enabled: bool }
|
|
72
|
+
const response = await apiTotp.totp_management.totpDevicesRetrieve();
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// Join all devices into a single array
|
|
76
|
-
const devices = response.results.flatMap((device) => device.devices);
|
|
77
|
-
const mappedDevices: TwoFactorDevice[] = devices.map((device) => ({
|
|
74
|
+
const mappedDevices: TwoFactorDevice[] = response.devices.map((device) => ({
|
|
78
75
|
id: device.id,
|
|
79
76
|
name: device.name,
|
|
80
77
|
createdAt: device.created_at,
|
|
@@ -83,12 +80,9 @@ export const useTwoFactorStatus = (): UseTwoFactorStatusReturn => {
|
|
|
83
80
|
}));
|
|
84
81
|
|
|
85
82
|
setDevices(mappedDevices);
|
|
86
|
-
|
|
87
|
-
// 2FA is enabled if there are any devices
|
|
88
|
-
const enabled = mappedDevices.length > 0;
|
|
89
|
-
setHas2FAEnabled(enabled);
|
|
83
|
+
setHas2FAEnabled(response.has_2fa_enabled);
|
|
90
84
|
|
|
91
|
-
authLogger.info('2FA status:',
|
|
85
|
+
authLogger.info('2FA status:', response.has_2fa_enabled ? 'enabled' : 'disabled');
|
|
92
86
|
|
|
93
87
|
} catch (err) {
|
|
94
88
|
const errorMessage = err instanceof Error ? err.message : 'Failed to fetch 2FA status';
|
package/src/_api/generated/cfg_totp/_utils/schemas/PaginatedDeviceListResponseList.schema.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for PaginatedDeviceListResponseList
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* */
|
|
6
|
-
import { z } from 'zod'
|
|
7
|
-
import { DeviceListResponseSchema } from './DeviceListResponse.schema'
|
|
8
|
-
|
|
9
|
-
export const PaginatedDeviceListResponseListSchema = z.object({
|
|
10
|
-
count: z.number().int(),
|
|
11
|
-
page: z.number().int(),
|
|
12
|
-
pages: z.number().int(),
|
|
13
|
-
page_size: z.number().int(),
|
|
14
|
-
has_next: z.boolean(),
|
|
15
|
-
has_previous: z.boolean(),
|
|
16
|
-
next_page: z.number().int().nullable().optional(),
|
|
17
|
-
previous_page: z.number().int().nullable().optional(),
|
|
18
|
-
results: z.array(DeviceListResponseSchema),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Infer TypeScript type from Zod schema
|
|
23
|
-
*/
|
|
24
|
-
export type PaginatedDeviceListResponseList = z.infer<typeof PaginatedDeviceListResponseListSchema>
|