Fix base64_encode typo

parent d02d502b
......@@ -131,7 +131,7 @@ function check_authentication_header($username, $password)
$header = $headers['Authorization'];
$auth_parts = [];
if (preg_match('/^Basic (.+)$/', $header, $auth_parts) === 1) {
if ($auth_parts[1] !== md5("{$username}:{$password}")) {
if ($auth_parts[1] !== base64_encode("{$username}:{$password}")) {
error_response(['message' => 'Error: Invalid or Missing Basic Authorization Credentials'], 401);
}
} else {
......
......@@ -50,7 +50,7 @@ class AuthorizationGuard
$header = $headers['Authorization'];
$auth_parts = [];
if (preg_match('/^Basic (.+)$/', $header, $auth_parts) === 1) {
if ($auth_parts[1] !== md5("{$this->_username}:{$this->_password}")) {
if ($auth_parts[1] !== base64_encode("{$this->_username}:{$this->_password}")) {
$auth = [
"message" => "Error: Invalid Credentials"
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment