File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ def do_POST(self):
136
136
137
137
cipher_suite = Fernet (REPLACEWITHFERNETKEY )
138
138
enc = cipher_suite .encrypt (ensure_bytes (user + ':' + passwd ))
139
- self .send_header ('Set-Cookie' , b 'nginxauth=' + enc + b '; httponly' )
139
+ self .send_header ('Set-Cookie' , 'nginxauth=' + enc + '; httponly' )
140
140
141
141
self .send_header ('Location' , target )
142
142
self .end_headers ()
Original file line number Diff line number Diff line change @@ -88,11 +88,12 @@ def do_GET(self):
88
88
cipher_suite = Fernet(REPLACEWITHFERNETKEY)
89
89
self.log_message(' Trying to dechipher credentials...' )
90
90
auth_decoded = cipher_suite.decrypt(auth_header[6:])
91
+ auth_decoded = auth_decoded.decode(" utf-8" )
91
92
user, passwd = auth_decoded.split(' :' , 1)
92
93
except InvalidToken:
93
94
self.log_message(' Incorrect token. Trying to decode credentials from BASE64...' )
94
95
auth_decoded = base64.b64decode(auth_header[6:])
95
- if sys.version_info.major == 3: auth_decoded = auth_decoded.decode(" utf-8" )
96
+ auth_decoded = auth_decoded.decode(" utf-8" )
96
97
user, passwd = auth_decoded.split(' :' , 1)
97
98
except Exception as e:
98
99
self.auth_failed(ctx)
You can’t perform that action at this time.
0 commit comments