mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 17:20:30 +08:00
kvmd-totp del
This commit is contained in:
parent
cbebc1fa52
commit
67d2e33573
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user