merged for the last time, now with loggin of wrong password and password recovery
This commit is contained in:
commit
1bbd30bbee
1 file changed
+20
-8
+20
-8
@@ -14,7 +14,11 @@ class ActionParser {
|
|||||||
//Actions that don't require login
|
//Actions that don't require login
|
||||||
switch ($this->action) {
|
switch ($this->action) {
|
||||||
case 'order-password' :
|
case 'order-password' :
|
||||||
$this->_orderPassword();
|
$tmp = $this->_orderPassword();
|
||||||
|
if(!$tmp)
|
||||||
|
$this->logError(scriptParam('userid'), 'Tried to recover password but failed');
|
||||||
|
else
|
||||||
|
$this->logError(scriptParam('userid'), 'Retreived password, probably sent by mail');
|
||||||
break;
|
break;
|
||||||
case 'email-lookup' :
|
case 'email-lookup' :
|
||||||
$this->_emailLookup();
|
$this->_emailLookup();
|
||||||
@@ -574,6 +578,13 @@ class ActionParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function logError($username = 'lol', $error)
|
||||||
|
{
|
||||||
|
$conn = db_connect();
|
||||||
|
$sql = sprintf("INSERT INTO `inside_auth_log`(`username`, `error`) VALUES(%s,%s)",$conn->quoteSmart(scriptParam('username')), $conn->quoteSmart($error));
|
||||||
|
$conn->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
public function _logIn() {
|
public function _logIn() {
|
||||||
$conn = db_connect();
|
$conn = db_connect();
|
||||||
|
|
||||||
@@ -604,10 +615,12 @@ class ActionParser {
|
|||||||
$result = $conn->query($sql);
|
$result = $conn->query($sql);
|
||||||
$userExists = $result->numRows() > 0;
|
$userExists = $result->numRows() > 0;
|
||||||
|
|
||||||
$error = true;
|
$error = '';
|
||||||
$passwordExists = scriptParam('password') != '';
|
if(scriptParam('password') == '')
|
||||||
|
{
|
||||||
if($userExists)
|
$error = 'no password supplied?';
|
||||||
|
}
|
||||||
|
elseif($userExists)
|
||||||
{
|
{
|
||||||
$error = "user exists, wrong password?";
|
$error = "user exists, wrong password?";
|
||||||
}
|
}
|
||||||
@@ -615,9 +628,8 @@ class ActionParser {
|
|||||||
{
|
{
|
||||||
$error = "user not found..";
|
$error = "user not found..";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf("INSERT INTO `inside_auth_log`(`username`, `password`,`error`) VALUES(%s,%s,%s)",$conn->quoteSmart(scriptParam('username')), $conn->quoteSmart($passwordExists), $conn->quoteSmart($error));
|
$this->logError(scriptParam('username'), $error);
|
||||||
$conn->query($sql);
|
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user