Skip to content

Commit 7375c98

Browse files
Add write to log
1 parent 34572fe commit 7375c98

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

HttpBasicAuthComponent.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,24 @@ protected function _fail()
6161
{
6262
$appName = \Yii::$app->name;
6363

64+
$user = \Yii::$app->request->authUser;
65+
$password = \Yii::$app->request->authPassword;
66+
$ip = \Yii::$app->request->userIP;
67+
68+
6469
if ($this->viewFail)
6570
{
6671
Header("WWW-Authenticate: Basic realm=\"{$appName}\"");
6772
Header("HTTP/1.0 401 Unauthorized");
6873

74+
\Yii::error("Fail http basic auth $user@$password ({$ip})", self::className());
6975
echo \Yii::$app->view->render($this->viewFail);
7076
} else
7177
{
7278
Header("WWW-Authenticate: Basic realm=\"{$appName}\"");
7379
Header("HTTP/1.0 401 Unauthorized");
80+
81+
\Yii::error("Fail http basic auth $user@$password ({$ip})", self::className());
7482
echo <<<HTML
7583
<style>
7684
.sx-title

0 commit comments

Comments
 (0)