diff options
author | Maxim Devaev <[email protected]> | 2023-01-23 03:27:22 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2023-01-23 03:27:22 +0200 |
commit | 67d2e33573f8e750599d9d5587b1ebfc1587431c (patch) | |
tree | f088ab60cb6c21dea027b487b76521fac4b506a7 /kvmd/apps | |
parent | cbebc1fa526f14d2bd7e190cab3e3a05c6f60e85 (diff) |
kvmd-totp del
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/totp/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kvmd/apps/totp/__init__.py b/kvmd/apps/totp/__init__.py index 64be9b90..ebd2ebe4 100644 --- a/kvmd/apps/totp/__init__.py +++ b/kvmd/apps/totp/__init__.py @@ -67,6 +67,12 @@ def _cmd_show(config: Section, _: argparse.Namespace) -> None: print() +def _cmd_delete(config: Section, _: argparse.Namespace) -> None: + with open(_get_secret_path(config), "w") as file: + file.write("") + print("TOTP is disabled now") + + # ===== def main(argv: (list[str] | None)=None) -> None: (parent_parser, argv, config) = init( @@ -89,5 +95,8 @@ def main(argv: (list[str] | None)=None) -> None: cmd_show_parser = subparsers.add_parser("show", help="Show the current TOTP secret with QR code") cmd_show_parser.set_defaults(cmd=_cmd_show) + cmd_delete_parser = subparsers.add_parser("del", help="Remove TOTP secret and disable 2FA auth") + cmd_delete_parser.set_defaults(cmd=_cmd_delete) + options = parser.parse_args(argv[1:]) options.cmd(config, options) |