From 48d12ac62cde5dcc4e62c4f0c6a4791f09f22041 Mon Sep 17 00:00:00 2001 From: Mounir Date: Sun, 29 Apr 2018 21:57:54 +0200 Subject: [PATCH] Setting api key will save it as a byte urlsafe_b64encode return a byte, which will result in an api key saved with something like b'apikey' I did not tested it but urlsafe_b64decode looks like doing the job also. --- hc/accounts/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hc/accounts/models.py b/hc/accounts/models.py index 86802626..e3ff53b0 100644 --- a/hc/accounts/models.py +++ b/hc/accounts/models.py @@ -118,7 +118,7 @@ class Profile(models.Model): emails.change_email(self.user.email, ctx) def set_api_key(self): - self.api_key = urlsafe_b64encode(os.urandom(24)) + self.api_key = urlsafe_b64encode(os.urandom(24)).decode() self.save() def checks_from_all_teams(self):