diff options
author | Vincent Post <cent@spline.de> | 2020-08-07 18:16:57 +0200 |
---|---|---|
committer | Jonah BrĂ¼chert <jbb@kaidan.im> | 2023-05-22 00:28:12 +0200 |
commit | 955e66c149a8df3a1af78d8766eb46b78af76a82 (patch) | |
tree | 1598aadb0ec21c91b4d54f70a4016336bae33fe7 | |
parent | c70cd40a012760e584677940d90d4d6613176238 (diff) | |
download | web-955e66c149a8df3a1af78d8766eb46b78af76a82.tar.gz web-955e66c149a8df3a1af78d8766eb46b78af76a82.tar.bz2 web-955e66c149a8df3a1af78d8766eb46b78af76a82.zip |
2to3: UTF-8 is now default in Python 3
-rw-r--r-- | accounts/backend/user/dummy.py | 3 | ||||
-rw-r--r-- | accounts/default_settings.py | 2 | ||||
-rw-r--r-- | accounts/models.py | 15 | ||||
-rw-r--r-- | accounts/utils/sessions.py | 2 |
4 files changed, 4 insertions, 18 deletions
diff --git a/accounts/backend/user/dummy.py b/accounts/backend/user/dummy.py index 573ac85..c1dbcb4 100644 --- a/accounts/backend/user/dummy.py +++ b/accounts/backend/user/dummy.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - from copy import deepcopy from fnmatch import fnmatch diff --git a/accounts/default_settings.py b/accounts/default_settings.py index 25ff814..cf36c6c 100644 --- a/accounts/default_settings.py +++ b/accounts/default_settings.py @@ -5,7 +5,7 @@ DEBUG = False SECRET_KEY = 'remember to change this to something more random and secret' # CHANGE THIS! (e.g. os.urandom(32) ) -SESSION_ENCRYPTION_KEY = '.\x14\xa7\x1b\xa2:\x1b\xb7\xbck\x1bD w\xab\x87a\xb4\xb7\xca\xf1\x06\xb0\x9f?q\x13\x05\x8dY\xe5<' +SESSION_ENCRYPTION_KEY = b'.\x14\xa7\x1b\xa2:\x1b\xb7\xbck\x1bD w\xab\x87a\xb4\xb7\xca\xf1\x06\xb0\x9f?q\x13\x05\x8dY\xe5<' MAIL_DEFAULT_SENDER = 'spline accounts <noreply@accounts.spline.de>' MAIL_REGISTER_NOTIFY = None diff --git a/accounts/models.py b/accounts/models.py index 40db977..aa0e4d0 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from flask.ext.login import UserMixin from accounts.utils.login import create_userid @@ -13,9 +11,9 @@ class Account(UserMixin): _ready = False def __init__(self, uid, mail, services=None, password=None, uidNumber=None): - self.uid = uid.encode('utf8') if isinstance(uid, str) else uid + self.uid = uid self.services = list() if services is None else services - self.password = password.encode('utf8') if isinstance(password, str) else password + self.password = password self.new_password_root = None self.new_password_services = {} self.attributes = {} @@ -37,21 +35,12 @@ class Account(UserMixin): the root password will be changed. """ - if isinstance(new_password, str): - new_password = new_password.encode('utf8') - - if isinstance(old_password, str): - old_password = old_password.encode('utf8') - if not service: self.new_password_root = (old_password, new_password) else: self.new_password_services[service] = (old_password, new_password) def _set_attribute(self, key, value): - if isinstance(value, str): - value = value.encode('utf8') - self.attributes[key] = value def change_email(self, new_mail): diff --git a/accounts/utils/sessions.py b/accounts/utils/sessions.py index 7b24f8a..1b4a168 100644 --- a/accounts/utils/sessions.py +++ b/accounts/utils/sessions.py @@ -10,7 +10,7 @@ from itsdangerous import BadPayload def _pad(value, block_size): padding = block_size - len(value) % block_size - return value + (padding * chr(padding)) + return (value + (padding * chr(padding))).encode("UTF-8") def _unpad(value): |