ipa-passwd: add OTP support

https://fedorahosted.org/freeipa/ticket/4262

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik
2014-05-23 09:36:49 +02:00
parent 896920ed12
commit 2df6542232
3 changed files with 14 additions and 4 deletions

View File

@@ -2409,10 +2409,11 @@ 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: passwd
args: 3,1,3
args: 3,2,3
arg: Str('principal', autofill=True, cli_name='user', primary_key=True)
arg: Password('password')
arg: Password('current_password', autofill=True, confirm=False)
option: Password('otp?', confirm=False)
option: Str('version?', exclude='webui')
output: Output('result', <type 'bool'>, None)
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)

View File

@@ -89,5 +89,5 @@ IPA_DATA_VERSION=20100614120000
# #
########################################################
IPA_API_VERSION_MAJOR=2
IPA_API_VERSION_MINOR=93
# Last change: mbasti - New record type added: DLV
IPA_API_VERSION_MINOR=94
# Last change: pvoborni - Add OTP option to passwd command

View File

@@ -89,6 +89,14 @@ class passwd(Command):
),
)
takes_options = (
Password('otp?',
label=_('OTP'),
doc=_('One Time Password'),
confirm=False,
),
)
has_output = output.standard_value
msg_summary = _('Changed password for "%(value)s"')
@@ -121,7 +129,8 @@ class passwd(Command):
if current_password == MAGIC_VALUE:
ldap.modify_password(entry_attrs.dn, password)
else:
ldap.modify_password(entry_attrs.dn, password, current_password)
otp = options.get('otp')
ldap.modify_password(entry_attrs.dn, password, current_password, otp)
return dict(
result=True,