Store Users IP address in accounts after login

Fixes #177
This commit is contained in:
Sebastian Grewe 2013-06-13 13:46:32 +02:00
parent 785c04441c
commit 6a5f938895

View File

@ -69,7 +69,6 @@ class User {
);
return $this->updateSingle($id, $field);
}
public function setUserToken($id) {
$field = array(
'name' => 'token',
@ -78,6 +77,10 @@ class User {
);
return $this->updateSingle($id, $field);
}
private function setUserIp($id, $ip) {
$field = array( 'name' => 'loggedIp', 'type' => 's', 'value' => $ip );
return $this->updateSingle($id, $field);
}
/**
* Fetch all users for administrative tasks
@ -106,6 +109,7 @@ class User {
}
if ( $this->checkUserPassword($username, $password)) {
$this->createSession($username);
$this->setUserIp($this->getUserId($username), $_SERVER['REMOTE_ADDR']);
return true;
}
$this->setErrorMessage("Invalid username or password");