mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-04 10:24:07 +02:00
upload framework
This commit is contained in:
parent
754b1ce108
commit
a1a9504f11
30 changed files with 1578 additions and 155 deletions
|
|
@ -1,38 +0,0 @@
|
|||
<?php namespace Providers;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use RandomLib\Generator;
|
||||
|
||||
class AuthProvider extends BaseProvider {
|
||||
/**
|
||||
* @var Generator
|
||||
*/
|
||||
private $generator;
|
||||
|
||||
public function __construct(Connection $db, Generator $generator) {
|
||||
parent::__construct($db);
|
||||
$this->generator = $generator;
|
||||
}
|
||||
|
||||
public function generateToken() {
|
||||
return $this->generator->generateString(32, Generator::CHAR_ALNUM);
|
||||
}
|
||||
|
||||
public function setUser($token, \SteamId $steamid, $key) {
|
||||
apc_store($token, [
|
||||
'name' => $steamid->getNickname(),
|
||||
'steamid' => $steamid->getSteamId64(),
|
||||
'key' => $key
|
||||
]);
|
||||
}
|
||||
|
||||
public function getUser($token) {
|
||||
$found = true;
|
||||
$result = apc_fetch($token, $found);
|
||||
return ($found) ? $result : ['name' => null, 'steamid' => null, 'key' => null];
|
||||
}
|
||||
|
||||
public function logout($token) {
|
||||
apc_delete($token);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue