Merge branch 'develop'

This commit is contained in:
2020-02-18 12:14:34 -03:00

View File

@ -32,11 +32,16 @@ class Auth extends Model
}
public function time($time = null)
{
if ($this->container === null) {
$timezone = config('app.timezone');
} else {
$timezone = $this->container->get('settings')->app->timezone;
}
if ($time == null) {
return Carbon::parse($this->time, $this->container->get('settings')->app->timezone);
return Carbon::parse($this->time, $timezone);
}
if (!\is_a($time, \DateTime::class)) {
$time = Carbon::parse($time, $this->container->get('settings')->app->timezone);
$time = Carbon::parse($time, $timezone);
}
$this->time = $time;
}
@ -52,9 +57,19 @@ class Auth extends Model
if ($this->status == 0) {
return false;
}
$now = Carbon::now($this->container->get('settings')->app->timezone);
if ($this->container === null) {
$timezone = config('app.timezone');
} else {
$timezone = $this->container->get('settings')->app->timezone;
}
$now = Carbon::now($timezone);
$diff = $now->diffAsCarbonInterval($this->time, true);
if ($diff->totalHours > $this->container->get('settings')->app->login->hours) {
if ($this->container === null) {
$total_hours = config('app.login.hours');
} else {
$total_hours = $this->container->get('settings')->app->login->hours;
}
if ($diff->totalHours > $total_hours) {
return false;
}
return true;