Skip to content

Commit fb586a4

Browse files
author
Simon Fredsted
authored
Update basic_auth.ws
1 parent a2da514 commit fb586a4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: basic_auth.ws

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
if (var('request.header.php-auth-user') != 'user' and var('request.header.php-auth-pw') != 'pass') {
1+
function authenticate() {
22
respond('', 401, [
33
'WWW-Authenticate: Basic realm="User Visible Realm"'
44
]);
55
}
66

7+
user = var('request.header.php-auth-user')
8+
pass = var('request.header.php-auth-pw')
9+
10+
if (!user or !pass) {
11+
authenticate()
12+
}
13+
if (user != 'username' and pass != '1234') {
14+
authenticate()
15+
}
16+
717
respond('Login OK!');

0 commit comments

Comments
 (0)