diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-04-17 20:58:27 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-04-17 20:58:27 +0200 |
commit | 1c4182d9d88bb4471f86b08329f1b68a5290872b (patch) | |
tree | e7ccae68902113ece94ab4c8e86fd712dc028d2a /app/class/Controllerconnect.php | |
parent | dc5613c15b1b414fefadd66912ebf8ff3a5eef9d (diff) | |
download | wcms-1c4182d9d88bb4471f86b08329f1b68a5290872b.tar.gz wcms-1c4182d9d88bb4471f86b08329f1b68a5290872b.zip |
apply psr 12 part 2
Diffstat (limited to 'app/class/Controllerconnect.php')
-rw-r--r-- | app/class/Controllerconnect.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/app/class/Controllerconnect.php b/app/class/Controllerconnect.php index 8555e92..24b0c3c 100644 --- a/app/class/Controllerconnect.php +++ b/app/class/Controllerconnect.php @@ -39,7 +39,11 @@ class Controllerconnect extends Controller if (!empty($_POST['pass']) && !empty($_POST['user'])) { $this->user = $this->usermanager->passwordcheck($_POST['user'], $_POST['pass']); if ($this->user != false) { - if ($this->user->expiredate() === false || $this->user->level() === 10 || $this->user->expiredate('date') > $this->now) { + if ( + $this->user->expiredate() === false + || $this->user->level() === 10 + || $this->user->expiredate('date') > $this->now + ) { $this->user->connectcounter(); $this->usermanager->add($this->user); $this->usermanager->writesession($this->user); @@ -52,7 +56,6 @@ class Controllerconnect extends Controller $_SESSION['user' . Config::basepath()]['authtoken'] = $token; } } - } } } @@ -67,7 +70,7 @@ class Controllerconnect extends Controller { $this->user = $this->usermanager->logout(); $this->usermanager->writesession($this->user); - if(!empty($_SESSION['user' . Config::basepath()]['authtoken'])) { + if (!empty($_SESSION['user' . Config::basepath()]['authtoken'])) { $this->destroyauthtoken($_SESSION['user' . Config::basepath()]['authtoken']); } if ($id !== null && $route !== 'home') { @@ -79,7 +82,7 @@ class Controllerconnect extends Controller /** * Create a token stored in the database and then a cookie - * + * * @return string|bool Token in cas of success, otherwise, false. */ public function createauthtoken() @@ -99,10 +102,10 @@ class Controllerconnect extends Controller /** * Create a cookie called `authtoken` - * + * * @param string $token Token string * @param int $conservation Time in day to keep the token - * + * * @return bool True in cas of success, otherwise, false. */ public function creatauthcookie(string $token, int $conservation): bool @@ -122,5 +125,4 @@ class Controllerconnect extends Controller //deleteauthcookie } - } |