[fix] Check password decryption and return the data without conversion

This commit is contained in:
Jérôme Lebleu 2014-10-01 21:19:47 +02:00
parent 19b28d43d0
commit a7249aee2d

View file

@ -145,4 +145,10 @@ class BaseAuthenticator(object):
else: else:
gpg = gnupg.GPG() gpg = gnupg.GPG()
gpg.encoding = 'utf-8' gpg.encoding = 'utf-8'
return str(gpg.decrypt(enc_pwd, passphrase=session_hash))
decrypted = gpg.decrypt(enc_pwd, passphrase=session_hash)
if decrypted.ok != True:
# TODO: Log decrypted.status
raise MoulinetteError(errno.EINVAL,
m18r.g('unable_retrieve_session'))
return decrypted.data