mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-16 08:23:12 +00:00
Merge branch 'fix_payment' into 'master'
Répare le champ AESField (test de value inutile) See merge request federez/re2o!81
This commit is contained in:
commit
2aec9782ed
1 changed files with 0 additions and 3 deletions
|
@ -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)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue