Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Apps/Controller/Front/User.php (2 issues)

php_analyzer.check_properties.missing_required_property.many

Unknown
1
<?php
2
3
namespace Apps\Controller\Front;
4
5
use Extend\Core\Arch\FrontAppController;
6
use Ffcms\Core\App;
7
use Ffcms\Core\Exception\ForbiddenException;
8
9
/**
10
 * Class User - standard user controller: login/signup/logout/etc
11
 * @package Apps\Controller\Front
12
 */
13
class User extends FrontAppController
14
{
15
    const EVENT_USER_LOGIN_SUCCESS = 'user.login.success';
16
    const EVENT_USER_LOGIN_FAIL = 'user.login.fail';
17
    const EVENT_USER_REGISTER_SUCCESS = 'user.signup.success';
18
    const EVENT_USER_REGISTER_FAIL = 'user.signup.fail';
19
    const EVENT_USER_RECOVERY_SUCCESS = 'user.recovery.success';
20
21
    use User\ActionLogin {
22
        login as actionLogin;
23
    }
24
25
    use User\ActionSignup {
0 ignored issues
show
The trait Apps\Controller\Front\User\ActionSignup requires some properties which are not provided by Apps\Controller\Front\User: $query, $_userObject
Loading history...
26
        signup as actionSignup;
27
    }
28
29
    use User\ActionSocialAuth {
0 ignored issues
show
The trait Apps\Controller\Front\User\ActionSocialAuth requires some properties which are not provided by Apps\Controller\Front\User: $identifier, $_userObject
Loading history...
30
        socialauth as actionSocialauth;
31
    }
32
33
    use User\ActionRecovery {
34
        recovery as actionRecovery;
35
    }
36
37
    use User\ActionApprove {
38
        approve as actionApprove;
39
    }
40
41
    /**
42
     * Make logout if user is signIn
43
     * @throws ForbiddenException
44
     */
45
    public function actionLogout()
46
    {
47
        // check if user authorized
48
        if (!App::$User->isAuth()) {
49
            throw new ForbiddenException(__('You are not authorized user'));
50
        }
51
52
        // unset session data
53
        App::$Session->invalidate();
54
55
        // redirect to main
56
        $this->response->redirect('/');
57
    }
58
}
59