M
M
Maybe_V2016-08-21 20:22:09
Yii
Maybe_V, 2016-08-21 20:22:09

How to set up an error output when a controller rule is violated?

I put a restriction on access to the actioncontroller, prescribed the following rule:

[
  'allow' => true,
  'actions' => ['login' , 'registration'],
  'roles' => ['?'],
],

Everything works correctly, but how can I make it so that when the rule is not executed (that is, the logged in user goes by trap) it throws a non-standard warning like :
An Error occurred while handling another error:
yii\web\ForbiddenHttpException: You are not allowed to perform this action.


Did it show a certain page?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2016-08-21
@prokopov-vi

www.yiiframework.com/doc-2.0/yii-filters-accesscon...
Everything is in the documentation, try to start with it next time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question