Upgrade LBCAlerte to version 3.3

Add upgrade script
This commit is contained in:
Jimmy Monin
2016-11-26 19:19:16 +01:00
parent a7c054b535
commit 58ffd500e6
89 changed files with 6436 additions and 758 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace Auth;
require_once __DIR__."/Abstract.php";
class ApiKey extends AuthAbstract
{
public function __construct(\App\Storage\User $storage)
{
if (!$this->_username && isset($_GET["u"])) {
$this->setUsername($_GET["u"]);
}
if (!$this->_password && isset($_GET["key"])) {
$this->setPassword($_GET["key"]);
}
parent::__construct($storage);
}
public function authenticate()
{
if (!$this->_username || !$this->_password) {
return null;
}
$user = $this->_storage->fetchByUsername($this->_username);
if ($user && $user->getApiKey() == $this->_password) {
return $user;
}
return null;
}
}