mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[fix] Set authenticate handler if password is given (bugfix #228)
This commit is contained in:
parent
929d96fd93
commit
d2a47a0dba
1 changed files with 4 additions and 8 deletions
|
@ -329,9 +329,10 @@ class Interface(BaseInterface):
|
||||||
# auto-complete
|
# auto-complete
|
||||||
argcomplete.autocomplete(self.actionsmap.parser._parser)
|
argcomplete.autocomplete(self.actionsmap.parser._parser)
|
||||||
|
|
||||||
# Store the given password
|
# Set handler for authentication
|
||||||
# FIXME: improve security
|
if password:
|
||||||
self._password = password
|
msignals.set_handler('authenticate',
|
||||||
|
lambda a,h: a(password=password))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ret = self.actionsmap.process(args, timeout=5)
|
ret = self.actionsmap.process(args, timeout=5)
|
||||||
|
@ -363,11 +364,6 @@ class Interface(BaseInterface):
|
||||||
Handle the core.MoulinetteSignals.authenticate signal.
|
Handle the core.MoulinetteSignals.authenticate signal.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Try to use given password if any
|
|
||||||
if self._password is not None:
|
|
||||||
logger.info('using given password to authenticate')
|
|
||||||
return authenticator(password=self._password)
|
|
||||||
|
|
||||||
# TODO: Allow token authentication?
|
# TODO: Allow token authentication?
|
||||||
msg = m18n.n(help) if help else m18n.g('password')
|
msg = m18n.n(help) if help else m18n.g('password')
|
||||||
return authenticator(password=self._do_prompt(msg, True, False,
|
return authenticator(password=self._do_prompt(msg, True, False,
|
||||||
|
|
Loading…
Add table
Reference in a new issue