@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
package/dist/auth.mjs
CHANGED
|
@@ -2622,15 +2622,8 @@ var TotpManagement = class {
|
|
|
2622
2622
|
/**
|
|
2623
2623
|
* List all TOTP devices for user.
|
|
2624
2624
|
*/
|
|
2625
|
-
async
|
|
2626
|
-
const
|
|
2627
|
-
let params;
|
|
2628
|
-
if (isParamsObject) {
|
|
2629
|
-
params = args[0];
|
|
2630
|
-
} else {
|
|
2631
|
-
params = { ordering: args[0], page: args[1], page_size: args[2], search: args[3] };
|
|
2632
|
-
}
|
|
2633
|
-
const response = await this.client.request("GET", "/cfg/totp/devices/", { params });
|
|
2625
|
+
async totpDevicesRetrieve() {
|
|
2626
|
+
const response = await this.client.request("GET", "/cfg/totp/devices/");
|
|
2634
2627
|
return response;
|
|
2635
2628
|
}
|
|
2636
2629
|
/**
|
|
@@ -3417,81 +3410,67 @@ var DisableRequestSchema = z30.object({
|
|
|
3417
3410
|
code: z30.string().min(6).max(6)
|
|
3418
3411
|
});
|
|
3419
3412
|
|
|
3420
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3413
|
+
// src/_api/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts
|
|
3421
3414
|
import { z as z31 } from "zod";
|
|
3422
|
-
var
|
|
3423
|
-
|
|
3424
|
-
page: z31.number().int(),
|
|
3425
|
-
pages: z31.number().int(),
|
|
3426
|
-
page_size: z31.number().int(),
|
|
3427
|
-
has_next: z31.boolean(),
|
|
3428
|
-
has_previous: z31.boolean(),
|
|
3429
|
-
next_page: z31.number().int().nullable().optional(),
|
|
3430
|
-
previous_page: z31.number().int().nullable().optional(),
|
|
3431
|
-
results: z31.array(DeviceListResponseSchema)
|
|
3415
|
+
var SetupRequestSchema = z31.object({
|
|
3416
|
+
device_name: z31.string().min(1).max(100).optional()
|
|
3432
3417
|
});
|
|
3433
3418
|
|
|
3434
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3419
|
+
// src/_api/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts
|
|
3435
3420
|
import { z as z32 } from "zod";
|
|
3436
|
-
var
|
|
3437
|
-
|
|
3421
|
+
var SetupResponseSchema = z32.object({
|
|
3422
|
+
device_id: z32.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
3423
|
+
secret: z32.string(),
|
|
3424
|
+
provisioning_uri: z32.string(),
|
|
3425
|
+
qr_code_base64: z32.string(),
|
|
3426
|
+
expires_in: z32.number().int()
|
|
3438
3427
|
});
|
|
3439
3428
|
|
|
3440
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3429
|
+
// src/_api/generated/cfg_totp/_utils/schemas/TotpVerifyUser.schema.ts
|
|
3441
3430
|
import { z as z33 } from "zod";
|
|
3442
|
-
var
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3431
|
+
var TotpVerifyUserSchema = z33.object({
|
|
3432
|
+
id: z33.number().int(),
|
|
3433
|
+
email: z33.email(),
|
|
3434
|
+
first_name: z33.string().max(50).optional(),
|
|
3435
|
+
last_name: z33.string().max(50).optional(),
|
|
3436
|
+
full_name: z33.string(),
|
|
3437
|
+
initials: z33.string(),
|
|
3438
|
+
display_username: z33.string(),
|
|
3439
|
+
company: z33.string().max(100).optional(),
|
|
3440
|
+
phone: z33.string().max(20).optional(),
|
|
3441
|
+
position: z33.string().max(100).optional(),
|
|
3442
|
+
language: z33.string().max(10).optional(),
|
|
3443
|
+
avatar: z33.string().nullable(),
|
|
3444
|
+
is_staff: z33.boolean(),
|
|
3445
|
+
is_superuser: z33.boolean(),
|
|
3446
|
+
date_joined: z33.string().datetime({ offset: true }),
|
|
3447
|
+
last_login: z33.string().datetime({ offset: true }).nullable(),
|
|
3448
|
+
unanswered_messages_count: z33.number().int()
|
|
3448
3449
|
});
|
|
3449
3450
|
|
|
3450
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3451
|
+
// src/_api/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts
|
|
3451
3452
|
import { z as z34 } from "zod";
|
|
3452
|
-
var
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
first_name: z34.string().max(50).optional(),
|
|
3456
|
-
last_name: z34.string().max(50).optional(),
|
|
3457
|
-
full_name: z34.string(),
|
|
3458
|
-
initials: z34.string(),
|
|
3459
|
-
display_username: z34.string(),
|
|
3460
|
-
company: z34.string().max(100).optional(),
|
|
3461
|
-
phone: z34.string().max(20).optional(),
|
|
3462
|
-
position: z34.string().max(100).optional(),
|
|
3463
|
-
language: z34.string().max(10).optional(),
|
|
3464
|
-
avatar: z34.string().nullable(),
|
|
3465
|
-
is_staff: z34.boolean(),
|
|
3466
|
-
is_superuser: z34.boolean(),
|
|
3467
|
-
date_joined: z34.string().datetime({ offset: true }),
|
|
3468
|
-
last_login: z34.string().datetime({ offset: true }).nullable(),
|
|
3469
|
-
unanswered_messages_count: z34.number().int()
|
|
3453
|
+
var VerifyBackupRequestSchema = z34.object({
|
|
3454
|
+
session_id: z34.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
3455
|
+
backup_code: z34.string().min(8).max(8)
|
|
3470
3456
|
});
|
|
3471
3457
|
|
|
3472
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3458
|
+
// src/_api/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts
|
|
3473
3459
|
import { z as z35 } from "zod";
|
|
3474
|
-
var
|
|
3460
|
+
var VerifyRequestSchema = z35.object({
|
|
3475
3461
|
session_id: z35.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
3476
|
-
|
|
3477
|
-
});
|
|
3478
|
-
|
|
3479
|
-
// src/_api/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts
|
|
3480
|
-
import { z as z36 } from "zod";
|
|
3481
|
-
var VerifyRequestSchema = z36.object({
|
|
3482
|
-
session_id: z36.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
3483
|
-
code: z36.string().min(6).max(6)
|
|
3462
|
+
code: z35.string().min(6).max(6)
|
|
3484
3463
|
});
|
|
3485
3464
|
|
|
3486
3465
|
// src/_api/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts
|
|
3487
|
-
import { z as
|
|
3488
|
-
var VerifyResponseSchema =
|
|
3489
|
-
message:
|
|
3490
|
-
access_token:
|
|
3491
|
-
refresh_token:
|
|
3466
|
+
import { z as z36 } from "zod";
|
|
3467
|
+
var VerifyResponseSchema = z36.object({
|
|
3468
|
+
message: z36.string(),
|
|
3469
|
+
access_token: z36.string(),
|
|
3470
|
+
refresh_token: z36.string(),
|
|
3492
3471
|
user: TotpVerifyUserSchema,
|
|
3493
|
-
remaining_backup_codes:
|
|
3494
|
-
warning:
|
|
3472
|
+
remaining_backup_codes: z36.number().int().optional(),
|
|
3473
|
+
warning: z36.string().optional()
|
|
3495
3474
|
});
|
|
3496
3475
|
|
|
3497
3476
|
// src/_api/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts
|
|
@@ -4445,9 +4424,8 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
|
|
|
4445
4424
|
setError(null);
|
|
4446
4425
|
try {
|
|
4447
4426
|
authLogger.info("Fetching 2FA status...");
|
|
4448
|
-
const response = await apiTotp.totp_management.
|
|
4449
|
-
const
|
|
4450
|
-
const mappedDevices = devices2.map((device) => ({
|
|
4427
|
+
const response = await apiTotp.totp_management.totpDevicesRetrieve();
|
|
4428
|
+
const mappedDevices = response.devices.map((device) => ({
|
|
4451
4429
|
id: device.id,
|
|
4452
4430
|
name: device.name,
|
|
4453
4431
|
createdAt: device.created_at,
|
|
@@ -4455,9 +4433,8 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
|
|
|
4455
4433
|
isPrimary: device.is_primary
|
|
4456
4434
|
}));
|
|
4457
4435
|
setDevices(mappedDevices);
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
authLogger.info("2FA status:", enabled ? "enabled" : "disabled");
|
|
4436
|
+
setHas2FAEnabled(response.has_2fa_enabled);
|
|
4437
|
+
authLogger.info("2FA status:", response.has_2fa_enabled ? "enabled" : "disabled");
|
|
4461
4438
|
} catch (err) {
|
|
4462
4439
|
const errorMessage = err instanceof Error ? err.message : "Failed to fetch 2FA status";
|
|
4463
4440
|
authLogger.error("Failed to fetch 2FA status:", err);
|