Commit 2aec9782 authored by chirac's avatar chirac
Browse files

Merge branch 'fix_payment' into 'master'

Répare le champ AESField (test de value inutile)

See merge request federez/re2o!81
parents 6dae1af9 d3a4d712
...@@ -27,14 +27,11 @@ def encrypt(key, s): ...@@ -27,14 +27,11 @@ def encrypt(key, s):
def decrypt(key, s): def decrypt(key, s):
obj = AES.new(key) obj = AES.new(key)
ss = obj.decrypt(s) ss = obj.decrypt(s)
print(ss)
return ss.split(bytes(EOD, 'utf-8'))[0] return ss.split(bytes(EOD, 'utf-8'))[0]
class AESEncryptedField(models.CharField): class AESEncryptedField(models.CharField):
def save_form_data(self, instance, data): def save_form_data(self, instance, data):
if value is None:
return value
setattr(instance, self.name, setattr(instance, self.name,
binascii.b2a_base64(encrypt(settings.AES_KEY, data))) binascii.b2a_base64(encrypt(settings.AES_KEY, data)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment