fix encoding passwords
This commit is contained in:
parent
38c9f74b7b
commit
7be032bdc9
|
@ -145,13 +145,13 @@ class User(AbstractBaseUser):
|
||||||
self.encrypted_sensitive_data = key_crypted
|
self.encrypted_sensitive_data = key_crypted
|
||||||
|
|
||||||
def encrypt_data(self, data):
|
def encrypt_data(self, data):
|
||||||
pw = self.decrypt_sensitive_data()
|
pw = self.decrypt_sensitive_data().encode('utf-8')
|
||||||
sb = self.get_secret_box(pw)
|
sb = self.get_secret_box(pw)
|
||||||
value_enc = sb.encrypt(data.encode('utf-8'))
|
value_enc = sb.encrypt(data.encode('utf-8'))
|
||||||
return base64.b64encode(value_enc).decode('utf-8')
|
return base64.b64encode(value_enc).decode('utf-8')
|
||||||
|
|
||||||
def decrypt_data(self, data):
|
def decrypt_data(self, data):
|
||||||
pw = self.decrypt_sensitive_data()
|
pw = self.decrypt_sensitive_data().encode('utf-8')
|
||||||
sb = self.get_secret_box(pw)
|
sb = self.get_secret_box(pw)
|
||||||
value = base64.b64decode(data.encode('utf-8'))
|
value = base64.b64decode(data.encode('utf-8'))
|
||||||
return sb.decrypt(value).decode('utf-8')
|
return sb.decrypt(value).decode('utf-8')
|
||||||
|
|
Loading…
Reference in New Issue