<commit_before><?php

namespace App\Controller;

use Core\Application;
use App\Auth\AuthManager;
use App\Auth\LoginManagerInterface;
use App\Auth\AccountManagerInterface;

class Auth
{
    /**
     * @var AccountManagerInterface
     */
    private $accountManager;

    /**
     * @var LoginManagerInterface
     */
    private $loginManager;

    public function __construct()
    {
        $this->accountManager = AuthManager::getInstance()->getDefaultAccountManager();
        $this->loginManager = AuthManager::getInstance()->getDefaultLoginManager();
    }

    public function viewLoginForm()
    {
        return 'auth/login';
    }

    public function doLogin()
    {
        $this->loginManager->login($_POST['account_id'], $_POST['password']);
        return 'redirect: ' . Application::getInstance()->url();
    }

    public function doLogout()
    {
        $this->loginManager->logout();
        return 'redirect: ' . Application::getInstance()->url();
    }
}<commit_msg>Auth::doLogin()에서 $_POST 사용하는 것을 PSR-7의 ServerRequestInterface로 바꿈<commit_after><?php

namespace App\Controller;

use Core\Application;
use App\Auth\AuthManager;
use App\Auth\LoginManagerInterface;
use App\Auth\AccountManagerInterface;
use Psr\Http\Message\ServerRequestInterface;

class Auth
{
    /**
     * @var AccountManagerInterface
     */
    private $accountManager;

    /**
     * @var LoginManagerInterface
     */
    private $loginManager;

    public function __construct()
    {
        $this->accountManager = AuthManager::getInstance()->getDefaultAccountManager();
        $this->loginManager = AuthManager::getInstance()->getDefaultLoginManager();
    }

    public function viewLoginForm()
    {
        return 'auth/login';
    }

    public function doLogin(ServerRequestInterface $request)
    {
        $this->loginManager->login($request->getParsedBody()['account_id'], $request->getParsedBody()['password']);
        return 'redirect: ' . Application::getInstance()->url();
    }

    public function doLogout()
    {
        $this->loginManager->logout();
        return 'redirect: ' . Application::getInstance()->url();
    }
}
{'fraction_non_alphanumeric': 0.13672421838544097, 'fraction_numerical': 0.0004666355576294914, 'mean_word_length': 3.288, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1140782', 'n_tokens_mistral': 588, 'n_tokens_neox': 583, 'n_words': 105}