summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/auth.py
diff options
context:
space:
mode:
authorCalum Lind <calumlind@gmail.com>2018-10-02 15:39:51 +0100
committerCalum Lind <calumlind@gmail.com>2018-10-03 15:21:53 +0100
commitb1cdc32f7357e9777eb6cc2d90094c7d122af2eb (patch)
tree9106ac399a7df178c8dbed6fe58009d36b18159a /deluge/ui/web/auth.py
parentbcca07443ccad7f130444baaac52b7b49478905e (diff)
downloaddeluge-b1cdc32f7357e9777eb6cc2d90094c7d122af2eb.tar.gz
deluge-b1cdc32f7357e9777eb6cc2d90094c7d122af2eb.tar.bz2
deluge-b1cdc32f7357e9777eb6cc2d90094c7d122af2eb.zip
[Lint] Use Black to auto-format code
The move to using auto-formatter makes it easier to read, submit and speeds up development time. https://github.com/ambv/black/ Although I would prefer 79 chars, the default line length of 88 chars used by black suffices. The flake8 line length remains at 120 chars since black does not touch comments or docstrings and this will require another round of fixes. The only black setting that is not standard is the use of double-quotes for strings so disabled any formatting of these. Note however that flake8 will still flag usage of double-quotes. I may change my mind on double vs single quotes but for now leave them. A new pyproject.toml file has been created for black configuration.
Diffstat (limited to 'deluge/ui/web/auth.py')
-rw-r--r--deluge/ui/web/auth.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py
index 4ee526cbe..aefd879e6 100644
--- a/deluge/ui/web/auth.py
+++ b/deluge/ui/web/auth.py
@@ -103,8 +103,10 @@ class Auth(JSONComponent):
checksum = str(make_checksum(session_id))
request.addCookie(
- b'_session_id', session_id + checksum,
- path=request.base + 'json', expires=expires_str,
+ b'_session_id',
+ session_id + checksum,
+ path=request.base + 'json',
+ expires=expires_str,
)
log.debug('Creating session for %s', login)
@@ -144,6 +146,7 @@ class Auth(JSONComponent):
# We are using the 1.1 webui auth method
log.debug('Received a password via the 1.1 auth method')
from base64 import b64decode
+
m = hashlib.md5()
m.update(b64decode(config['old_pwd_salt']))
m.update(password.encode('utf8'))
@@ -200,8 +203,10 @@ class Auth(JSONComponent):
_session_id = request.getCookie('_session_id')
request.addCookie(
- b'_session_id', _session_id,
- path=request.base + b'json', expires=expires_str,
+ b'_session_id',
+ _session_id,
+ path=request.base + b'json',
+ expires=expires_str,
)
if method: