mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Enable QR code display by default in otptoken-add
This is possible because python-qrcode's output now fits in a standard terminal. Also, update ipa-otp-import and otptoken-add-yubikey to disable QR code output as it doesn't make sense in these contexts. https://fedorahosted.org/freeipa/ticket/4703 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
committed by
Petr Vobornik
parent
4e1193119b
commit
1cd2ca11c5
3
API.txt
3
API.txt
@@ -2592,7 +2592,7 @@ output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDA
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: otptoken_add
|
||||
args: 1,22,3
|
||||
args: 1,23,3
|
||||
arg: Str('ipatokenuniqueid', attribute=True, cli_name='id', multivalue=False, primary_key=True, required=False)
|
||||
option: Str('addattr*', cli_name='addattr', exclude='webui')
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
@@ -2611,6 +2611,7 @@ option: Int('ipatokentotpclockoffset', attribute=True, autofill=True, cli_name='
|
||||
option: Int('ipatokentotptimestep', attribute=True, autofill=True, cli_name='interval', default=30, minvalue=5, multivalue=False, required=False)
|
||||
option: Str('ipatokenvendor', attribute=True, cli_name='vendor', multivalue=False, required=False)
|
||||
option: Flag('no_members', autofill=True, default=False, exclude='webui')
|
||||
option: Flag('no_qrcode', autofill=True, default=False)
|
||||
option: Flag('qrcode?', autofill=True, default=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Str('setattr*', cli_name='setattr', exclude='webui')
|
||||
|
||||
4
VERSION
4
VERSION
@@ -90,5 +90,5 @@ IPA_DATA_VERSION=20100614120000
|
||||
# #
|
||||
########################################################
|
||||
IPA_API_VERSION_MAJOR=2
|
||||
IPA_API_VERSION_MINOR=108
|
||||
# Last change: pvoborni - manage authorization of keytab operations
|
||||
IPA_API_VERSION_MINOR=109
|
||||
# Last change: npmccallum - display qrcode by default
|
||||
|
||||
@@ -268,7 +268,8 @@ class otptoken_add(LDAPCreate):
|
||||
msg_summary = _('Added OTP token "%(value)s"')
|
||||
|
||||
takes_options = LDAPCreate.takes_options + (
|
||||
Flag('qrcode?', label=_('Display QR code')),
|
||||
Flag('qrcode?', label=_('(deprecated)'), flags=('no_option')),
|
||||
Flag('no_qrcode', label=_('Do not display QR code'), default=False),
|
||||
)
|
||||
|
||||
has_output_params = LDAPCreate.has_output_params + (
|
||||
@@ -348,7 +349,7 @@ class otptoken_add(LDAPCreate):
|
||||
rv = super(otptoken_add, self).output_for_cli(textui, output, *args, **options)
|
||||
|
||||
# Print QR code to terminal if specified
|
||||
if uri and options.get('qrcode', False):
|
||||
if uri and not options.get('no_qrcode', False):
|
||||
print "\n"
|
||||
qr = qrcode.QRCode()
|
||||
qr.add_data(uri)
|
||||
|
||||
@@ -124,6 +124,7 @@ class otptoken_add_yubikey(Command):
|
||||
ipatokenotpalgorithm=u'sha1',
|
||||
ipatokenhotpcounter=0,
|
||||
ipatokenotpkey=key,
|
||||
no_qrcode=True,
|
||||
**options)
|
||||
|
||||
# Suppress values we don't want to return.
|
||||
|
||||
@@ -517,7 +517,7 @@ class OTPTokenImport(admintool.AdminTool):
|
||||
# Parse tokens
|
||||
for keypkg in self.doc.getKeyPackages():
|
||||
try:
|
||||
api.Command.otptoken_add(keypkg.id, **keypkg.options)
|
||||
api.Command.otptoken_add(keypkg.id, no_qrcode=True, **keypkg.options)
|
||||
except Exception as e:
|
||||
self.log.warn("Error adding token: %s", e)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user