Debian Codegraph @

addons/auth_totp_portal/static/src/interactions/revoke_all_trusted_devices.js

raw
1 import { Interaction } from "@web/public/interaction";
2 import { registry } from "@web/core/registry";
3
4 import { handleCheckIdentity } from "@portal/interactions/portal_security";
5 import { user } from "@web/core/user";
6
7 export class RevokeAllTrustedDevices extends Interaction {
8 static selector = "#auth_totp_portal_revoke_all_devices";
9 dynamicContent = {
10 _root: { "t-on-click.prevent": this.onClick },
11 };
12
13 async onClick() {
14 await this.waitFor(handleCheckIdentity(
15 this.waitFor(this.services.orm.call("res.users", "revoke_all_devices", [user.userId])),
16 this.services.orm,
17 this.services.dialog,
18 ));
19 location.reload();
20 }
21 }
22
23 registry
24 .category("public.interactions")
25 .add("auth_totp_portal.revoke_all_trusted_devices", RevokeAllTrustedDevices);