Passed
Push — v5 ( e348bf...8a8f01 )
by Alexey
06:35
created

UsersController::loginAsAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
        if (!Users\User::$cur->user_id) {
15
            $this->view->page(['page' => 'login', 'content' => 'login']);
16
        } else {
17
            $this->view->page(['content' => 'profile']);
18
        }
19
    }
20
21
    public function loginAsAction($userId) {
22
        $user = Users\User::get($userId);
23
        App::$cur->users->newSession($user);
24
        Tools::redirect('/', 'Теперь вы на сайте под пользователем ' . $user->name());
0 ignored issues
show
Bug introduced by
The type Tools was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
    }
26
27
}
28