ProfileController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace app\controllers;
  3. use Yii;
  4. use app\models\OrganizerForm;
  5. use app\models\Profile;
  6. use app\models\User;
  7. class ProfileController extends \dektrium\user\controllers\ProfileController
  8. {
  9. public function behaviors()
  10. {
  11. $behaviors = parent::behaviors();
  12. $behaviors['access'] = [
  13. 'class' => AccessControl::className(),
  14. 'rules' => [
  15. [
  16. 'allow' => true,
  17. 'actions' => ['index', 'show'],
  18. 'roles' => ['@'],
  19. ],
  20. ],
  21. ];
  22. return $behaviors;
  23. }
  24. public function init()
  25. {
  26. parent::init();
  27. if(Yii::$app->user->isGuest)
  28. {
  29. return $this->redirect('/user/login');
  30. }
  31. }
  32. public function actions()
  33. {
  34. // return [
  35. // 'error' => [
  36. // 'class' => 'yii\web\ErrorAction',
  37. // ],
  38. // 'captcha' => [
  39. // 'class' => 'yii\captcha\CaptchaAction',
  40. // //'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
  41. // // 'transparent'=>true,
  42. // // 'minLength'=>3,
  43. // // 'maxLength'=>4,
  44. // ],
  45. // ];
  46. return array_merge(parent::actions(), [
  47. 'error' => [
  48. 'class' => 'yii\web\ErrorAction',
  49. ],
  50. 'captcha' => [
  51. 'class' => 'yii\captcha\CaptchaAction',
  52. ],
  53. ]);
  54. }
  55. }