This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Controllers/AuthController.php

26 lines
614 B
PHP
Raw Normal View History

<?php
namespace Szurubooru\Controllers;
final class AuthController extends AbstractController
{
private $authService;
public function __construct(\Szurubooru\Services\AuthService $authService)
{
$this->authService = $authService;
}
2014-08-30 15:04:33 +02:00
public function registerRoutes(\Szurubooru\Router $router)
{
$router->post('/api/login', [$this, 'login']);
$router->get('/api/login', [$this, 'login']);
}
public function login()
{
$input = new \Szurubooru\Helpers\InputReader();
$this->authService->loginFromCredentials($input->userName, $input->password);
return $this->authService->getLoginToken();
}
}