mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-21 05:10:41 +00:00
feat: add permanent trust functionality for devices with corresponding API and UI updates
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
revokeAuthorizedDeviceTrust,
|
||||
revokeAllAuthorizedDeviceTrust,
|
||||
setTotp,
|
||||
trustAuthorizedDevicePermanently,
|
||||
updateAuthorizedDeviceName,
|
||||
updateProfile,
|
||||
} from '@/lib/api/auth';
|
||||
@@ -208,6 +209,26 @@ export default function useAccountSecurityActions(options: UseAccountSecurityAct
|
||||
});
|
||||
},
|
||||
|
||||
openTrustDevicePermanently(device: AuthorizedDevice) {
|
||||
onSetConfirm({
|
||||
title: t('txt_trust_device_permanently'),
|
||||
message: t('txt_trust_device_permanently_for_name', { name: device.name }),
|
||||
danger: false,
|
||||
onConfirm: () => {
|
||||
onSetConfirm(null);
|
||||
void (async () => {
|
||||
try {
|
||||
await trustAuthorizedDevicePermanently(authedFetch, device.identifier);
|
||||
await refetchAuthorizedDevices();
|
||||
onNotify('success', t('txt_device_trusted_permanently'));
|
||||
} catch (error) {
|
||||
onNotify('error', error instanceof Error ? error.message : t('txt_trust_device_permanently_failed'));
|
||||
}
|
||||
})();
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
openRemoveDevice(device: AuthorizedDevice) {
|
||||
onSetConfirm({
|
||||
title: t('txt_remove_device'),
|
||||
|
||||
Reference in New Issue
Block a user