Mejoras a administracion

This commit is contained in:
2020-04-10 15:22:00 -04:00
parent bca4665721
commit 9e8533ea50
12 changed files with 43 additions and 27 deletions

View File

@ -11,8 +11,9 @@ class Login {
protected $password;
protected $filename;
protected $manager;
public function __construct(string $cookie_name, int $time_limit, string $encrypted_password, string $login_file, Filemanager $filemanager) {
public function __construct(string $cookie_name, int $time_limit, string $base_url, string $encrypted_password, string $login_file, Filemanager $filemanager) {
$this->cookie_name = $cookie_name;
$this->base_url = $base_url;
$this->time_limit = $time_limit;
$this->password = $encrypted_password;
$this->filename = $login_file;
@ -31,7 +32,7 @@ class Login {
public function saveCookie() {
$now = Carbon::now();
$exp = $now->addSeconds($this->time_limit);
\setcookie($this->cookie_name, implode(':', [$this->selector, $this->token]), $exp->timestamp, '/');
\setcookie($this->cookie_name, implode(':', [$this->selector, $this->token]), $exp->timestamp, $this->base_url);
}
public function removeCookie() {
\setcookie($this->cookie_name, '', Carbon::now()->timestamp, '/');