Fix for Python3

This commit is contained in:
Pavel Lychkousky 2020-01-13 17:29:26 +03:00 committed by GitHub
parent a3a04facf8
commit 48cdd5e593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -74,7 +74,7 @@ class AppHandler(BaseHTTPRequestHandler):
<tr>
<td>Username: <input type="text" name="username"/></td>
<tr>
<td>Password: <input type="text" name="password"/></td>
<td>Password: <input type="password" name="password"/></td>
<tr>
<td><input type="submit" value="Login"></td>
</table>
@ -119,6 +119,8 @@ class AppHandler(BaseHTTPRequestHandler):
#
# WARNING WARNING WARNING
enc = base64.b64encode(ensure_bytes(user + ':' + passwd))
if sys.version_info.major == 3:
enc = enc.decode()
self.send_header('Set-Cookie', b'nginxauth=' + enc + b'; httponly')
self.send_header('Location', target)