Completed
Push — master ( 54dd0f...5e6629 )
by Park Jong-Hun
03:04
created

Auth::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace App\Controller;
4
5
use Core\Application;
6
use App\Auth\AuthManager;
7
use App\Auth\LoginManagerInterface;
8
use App\Auth\AccountManagerInterface;
9
use Psr\Http\Message\ServerRequestInterface;
10
11
class Auth
12
{
13
    public function viewLoginForm()
14
    {
15
        return 'auth/login';
16
    }
17
18
    public function doLogin(ServerRequestInterface $request)
19
    {
20
        AuthManager::getLoginManager()->login($request->getParsedBody()['account_id'], $request->getParsedBody()['password']);
21
        return 'redirect: ' . Application::getInstance()->url();
22
    }
23
24
    public function doLogout()
25
    {
26
        AuthManager::getLoginManager()->logout();
27
        return 'redirect: ' . Application::getInstance()->url();
28
    }
29
}
30