So for some odd reason, when I use the redirect function, the page rendered does not have the debug toolbar visible or functional.
I can see the ajax call being made and the response is as it should be, however, it is never rendered. When inspecting, the response is in one giant quote and interpreted as text vs HTML.
It only happens when the redirect is from ‘on BeforeAction’. Anywhere else, it works as intended.
How can I fix this?
'on beforeAction' => function ($event) {
if (!Yii::$app->user->isGuest) {
$route = Yii::$app->controller->getRoute();
if (Yii::$app->user->identity->status == '5' && $route != 'site/email-confirmation' && $route
!= 'site/resend-email' && $route != 'site/confirm-email') {
Yii::$app->controller->redirect(['site/confirm-email']);
}
}
},