Completed
Push — master ( 5c516d...6e0e1d )
by Alexey
04:27
created

UsersController   B

Complexity

Total Complexity 36

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 10

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 8.8
c 0
b 0
f 0
wmc 36
lcom 0
cbo 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A loginAction() 0 8 1
A loginAsAction() 0 6 1
1
<?php
2
3
/**
4
 * Users admin controller
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
class UsersController extends adminController
12
{
13
    public function loginAction()
14
    {
15
        if (!Users\User::$cur->user_id) {
16
            $this->view->page(['page' => 'login', 'content' => 'login']);
17
        } else {
18
            $this->view->page(['content' => 'profile']);
19
        }
20
    }
21
22
    public function loginAsAction($userId)
23
    {
24
        $user = Users\User::get($userId);
25
        App::$cur->users->newSession($user);
26
        Tools::redirect('/', 'Теперь вы на сайте под пользователем ' . $user->name());
27
    }
28
29
}
30