mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add labels for passwords, fix output of exceptions, fix passwd output.
Passwords didn't have internationalizable labels. Exceptions that occured during required input weren't printed as unicode so weren't being translated properly. Don't use output_for_cli() directly in the passwd plugin, use output.Output. ticket 352
This commit is contained in:
parent
6c393e53b0
commit
a41e69fba3
@ -903,7 +903,7 @@ class cli(backend.Executioner):
|
||||
error = None
|
||||
while True:
|
||||
if error is not None:
|
||||
print '>>> %s: %s' % (param.label, error)
|
||||
print '>>> %s: %s' % (unicode(param.label), unicode(error))
|
||||
raw = self.Backend.textui.prompt(param.label, default)
|
||||
try:
|
||||
value = param(raw, **kw)
|
||||
|
@ -124,7 +124,7 @@ def _pre_migrate_group(ldap, pkey, dn, entry_attrs, failed, config, ctx):
|
||||
def validate_ldapuri(ugettext, ldapuri):
|
||||
m = re.match('^ldaps?://[-\w\.]+(:\d+)?$', ldapuri)
|
||||
if not m:
|
||||
err_msg = 'Invalid LDAP URI.'
|
||||
err_msg = _('Invalid LDAP URI.')
|
||||
raise errors.ValidationError(name='ldap_uri', error=err_msg)
|
||||
|
||||
|
||||
@ -171,6 +171,7 @@ class migrate_ds(Command):
|
||||
),
|
||||
Password('bindpw',
|
||||
cli_name='password',
|
||||
label=_('Password'),
|
||||
doc=_('bind password'),
|
||||
),
|
||||
)
|
||||
|
@ -39,6 +39,7 @@ from ipalib import api, errors, util
|
||||
from ipalib import Command
|
||||
from ipalib import Str, Password
|
||||
from ipalib import _
|
||||
from ipalib import output
|
||||
|
||||
|
||||
class passwd(Command):
|
||||
@ -54,9 +55,14 @@ class passwd(Command):
|
||||
autofill=True,
|
||||
create_default=lambda **kw: util.get_current_principal(),
|
||||
),
|
||||
Password('password'),
|
||||
Password('password',
|
||||
label=_('Password'),
|
||||
),
|
||||
)
|
||||
|
||||
has_output = output.standard_value
|
||||
msg_summary = _('Changed password for "%(value)s"')
|
||||
|
||||
def execute(self, principal, password):
|
||||
"""
|
||||
Execute the passwd operation.
|
||||
@ -84,11 +90,9 @@ class passwd(Command):
|
||||
|
||||
ldap.modify_password(dn, password)
|
||||
|
||||
return dict(result=True)
|
||||
|
||||
def output_for_cli(self, textui, result, principal, password):
|
||||
assert password is None
|
||||
textui.print_name(self.name)
|
||||
textui.print_dashed('Changed password for "%s."' % principal)
|
||||
return dict(
|
||||
result=True,
|
||||
value=principal,
|
||||
)
|
||||
|
||||
api.register(passwd)
|
||||
|
Loading…
Reference in New Issue
Block a user