mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Ask for password again if it fails
This commit is contained in:
parent
509a3a7f78
commit
576e2eb7ef
1 changed files with 11 additions and 4 deletions
15
yunohost.py
15
yunohost.py
|
@ -282,10 +282,17 @@ class YunoHostLDAP(Singleton):
|
|||
if password: self.pwd = password
|
||||
elif self.pwd: pass
|
||||
else:
|
||||
try:
|
||||
self.pwd = getpass.getpass(colorize(_('Admin Password: '), 'yellow'))
|
||||
except KeyboardInterrupt, EOFError:
|
||||
raise YunoHostError(125, _("Interrupted"))
|
||||
need_password = True
|
||||
while need_password:
|
||||
try:
|
||||
self.pwd = getpass.getpass(colorize(_('Admin Password: '), 'yellow'))
|
||||
self.conn.simple_bind_s('cn=admin,' + self.base, self.pwd)
|
||||
except KeyboardInterrupt, EOFError:
|
||||
raise YunoHostError(125, _("Interrupted"))
|
||||
except ldap.INVALID_CREDENTIALS:
|
||||
pass
|
||||
else:
|
||||
need_password = False
|
||||
|
||||
self.level = self.level+1
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue