jleclanche / python-bna

Python implementation of the mobile Blizzard Authenticator (TOTP)
https://eu.battle.net/support/en/article/24520
MIT License
250 stars 38 forks source link

bna new --set-default breaks the scripts, so it works again #21

Closed theAkito closed 4 years ago

theAkito commented 5 years ago

At first, bna new did not work, at all, as described in https://github.com/jleclanche/python-bna/issues/20 . I tried to trick Python a bit, so I ran bna new --set-default. Then it broke by pulling up the old interface back. Now I could initialize a new authenticator with bna -n followed by bna EU-****-****-****.

# Before:
bna --help
Usage: bna [OPTIONS] COMMAND [ARGS]...

Options:
  --config TEXT  Path to a different config file to use
  --version      Show the version and exit.
  --help         Show this message and exit.

Commands:
  delete             Delete an authenticator from the configuration
  list               List all configured authenticators
  new                Request a new authenticator
  restore            Recover an authenticator from its restore code
  set-default        Set an authenticator as the default one to use for...
  show               Show the current authenticator code
  show-restore-code  Display an authenticator's restore code
  show-secret        Display an authenticator's secret
  show-url           Display an authenticator's OTPAuth URL (for QR codes)
# These do not work.

# After:
bna --help
usage: bna [-h] [-n] [--config CONFIG] [-d] [-i] [-l] [-r REGION]
           [--remaining] [--restore SERIAL CODE] [--restore-code]
           [--otpauth-url] [--set-default] [-v]
           [serial]

positional arguments:
  serial

optional arguments:
  -h, --help            show this help message and exit
  -n, --new             request a new authenticator
  --config CONFIG       specify config file to use
  -d, --delete          delete a stored serial and its matching secret
  -i, --interactive     interactive mode: updates the token as soon as it
                        expires
  -l, --list            list all your active serials and exit
  -r REGION, --region REGION
                        desired region for new authenticators
  --remaining           also print the remaining time until the token expires
  --restore SERIAL CODE
                        restores an existing authenticator
  --restore-code        prints a serial's restore code and exit
  --otpauth-url         Print standard otpauth URL for use with OTP apps
  --set-default         set authenticator as default (also works when
                        requesting a new authenticator)
  -v, --version         show program's version number and exit
# These do actually work.
jleclanche commented 5 years ago

Sorry, can you elaborate what's wrong?

I did change the interface in master. I guess that's not released yet so there's no changelog for it. The list of changes is in this commit:

https://github.com/jleclanche/python-bna/commit/3084050278c4f5c25620b5277a69a5711845d39f

theAkito commented 5 years ago

@jleclanche Sorry, I am very tired now and I have to sleep, so I didn't provide enough information. I edited my OP now, so it should be clearer, now.

jleclanche commented 5 years ago

I'm going to release bna 5.0 and you can just do pip install bna for the latest version.

jleclanche commented 4 years ago

I can't reproduce any issue with bna new. Please reopen or open a new issue if you have clear repro steps on master / 5.0.