Skip to content

Commit 48cdd5e

Browse files
authored
Fix for Python3
1 parent a3a04fa commit 48cdd5e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

backend-sample-app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def auth_form(self, target = None):
7474
<tr>
7575
<td>Username: <input type="text" name="username"/></td>
7676
<tr>
77-
<td>Password: <input type="text" name="password"/></td>
77+
<td>Password: <input type="password" name="password"/></td>
7878
<tr>
7979
<td><input type="submit" value="Login"></td>
8080
</table>
@@ -119,6 +119,8 @@ def do_POST(self):
119119
#
120120
# WARNING WARNING WARNING
121121
enc = base64.b64encode(ensure_bytes(user + ':' + passwd))
122+
if sys.version_info.major == 3:
123+
enc = enc.decode()
122124
self.send_header('Set-Cookie', b'nginxauth=' + enc + b'; httponly')
123125

124126
self.send_header('Location', target)

0 commit comments

Comments
 (0)