New features
This commit is contained in:
parent
a64d7c6370
commit
42e3d7a11e
|
@ -32,7 +32,8 @@ class Login {
|
||||||
if(Session::get('fingerPrint')===$this->fingerPrint())
|
if(Session::get('fingerPrint')===$this->fingerPrint())
|
||||||
{
|
{
|
||||||
$username = Session::get('username');
|
$username = Session::get('username');
|
||||||
if(!empty($username)) {
|
|
||||||
|
return (!empty($username)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,12 +46,14 @@ class Login {
|
||||||
$username = trim($username);
|
$username = trim($username);
|
||||||
$password = trim($password);
|
$password = trim($password);
|
||||||
|
|
||||||
if(empty($username) || empty($password))
|
if(empty($username) || empty($password)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$user = $this->dbUsers->get($username);
|
$user = $this->dbUsers->get($username);
|
||||||
if($user==false)
|
if($user==false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$passwordHash = sha1($password.$user['salt']);
|
$passwordHash = sha1($password.$user['salt']);
|
||||||
|
|
||||||
|
@ -68,8 +71,9 @@ class Login {
|
||||||
{
|
{
|
||||||
// User agent
|
// User agent
|
||||||
$agent = getenv('HTTP_USER_AGENT');
|
$agent = getenv('HTTP_USER_AGENT');
|
||||||
if(empty($agent))
|
if(empty($agent)) {
|
||||||
$agent = 'Bludit/1.0 (Mr Nibbler Protocol)';
|
$agent = 'Bludit/1.0 (Mr Nibbler Protocol)';
|
||||||
|
}
|
||||||
|
|
||||||
// User IP
|
// User IP
|
||||||
if(getenv('HTTP_X_FORWARDED_FOR'))
|
if(getenv('HTTP_X_FORWARDED_FOR'))
|
||||||
|
@ -79,8 +83,9 @@ class Login {
|
||||||
else
|
else
|
||||||
$ip = getenv('REMOTE_ADDR');
|
$ip = getenv('REMOTE_ADDR');
|
||||||
|
|
||||||
if($random)
|
if($random) {
|
||||||
return sha1(mt_rand().$agent.$ip);
|
return sha1(mt_rand().$agent.$ip);
|
||||||
|
}
|
||||||
|
|
||||||
// DEBUG: Ver CLIENT IP, hay veces que retorna la ip ::1 y otras 127.0.0.1
|
// DEBUG: Ver CLIENT IP, hay veces que retorna la ip ::1 y otras 127.0.0.1
|
||||||
return sha1($agent);
|
return sha1($agent);
|
||||||
|
|
Loading…
Reference in New Issue