Blame view

frontend/controllers/SiteController.php 1.89 KB
d8c1a2e0   Yarik   Big commit artbox
1
  <?php
cc658b4c   Yarik   Big commit
2
3
      namespace frontend\controllers;
      
cc658b4c   Yarik   Big commit
4
5
6
      use yii\web\Controller;
      use yii\filters\VerbFilter;
      use yii\filters\AccessControl;
cc658b4c   Yarik   Big commit
7
      
d8c1a2e0   Yarik   Big commit artbox
8
      /**
cc658b4c   Yarik   Big commit
9
       * Site controller
d8c1a2e0   Yarik   Big commit artbox
10
       */
cc658b4c   Yarik   Big commit
11
      class SiteController extends Controller
d8c1a2e0   Yarik   Big commit artbox
12
      {
cc658b4c   Yarik   Big commit
13
14
15
16
17
18
19
20
21
22
23
24
          
          /**
           * @inheritdoc
           */
          public function behaviors()
          {
              return [
                  'access' => [
                      'class' => AccessControl::className(),
                      'only'  => [
                          'logout',
                          'signup',
d8c1a2e0   Yarik   Big commit artbox
25
                      ],
cc658b4c   Yarik   Big commit
26
27
28
29
30
31
32
33
34
35
36
                      'rules' => [
                          [
                              'actions' => [ 'signup' ],
                              'allow'   => true,
                              'roles'   => [ '?' ],
                          ],
                          [
                              'actions' => [ 'logout' ],
                              'allow'   => true,
                              'roles'   => [ '@' ],
                          ],
d8c1a2e0   Yarik   Big commit artbox
37
38
                      ],
                  ],
cc658b4c   Yarik   Big commit
39
40
41
42
43
                  'verbs'  => [
                      'class'   => VerbFilter::className(),
                      'actions' => [
                          'logout' => [ 'post' ],
                      ],
d8c1a2e0   Yarik   Big commit artbox
44
                  ],
cc658b4c   Yarik   Big commit
45
              ];
d8c1a2e0   Yarik   Big commit artbox
46
          }
cc658b4c   Yarik   Big commit
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
          
          /**
           * @inheritdoc
           */
          public function actions()
          {
              return [
                  'error'   => [
                      'class' => 'yii\web\ErrorAction',
                  ],
                  'captcha' => [
                      'class'           => 'yii\captcha\CaptchaAction',
                      'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : NULL,
                  ],
              ];
d8c1a2e0   Yarik   Big commit artbox
62
          }
cc658b4c   Yarik   Big commit
63
64
65
66
67
68
69
          
          /**
           * Displays homepage.
           * @return mixed
           */
          public function actionIndex()
          {
5c2eb7c8   Yarik   Big commit almost...
70
              return $this->render('index');
36d1807a   Yarik   Big commit.
71
          }
d8c1a2e0   Yarik   Big commit artbox
72
      }