Reputation: 745
I'm using this module for Yii 2 for my user registrations: https://github.com/dektrium/yii2-user
I wanted to set up auto login, so I used the solution here: https://github.com/dektrium/yii2-user/issues/685
// ...
'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
'controllerMap' => [
'registration' => [
'class' => \dektrium\user\controllers\RegistrationController::className(),
'on ' . \dektrium\user\controllers\RegistrationController::EVENT_AFTER_REGISTER => function ($e) {
$user = \dektrium\user\models\User::findOne(['username'=>$e->form->username, 'email'=>$e->form->email]);
if ($user) {
Yii::$app->user->switchIdentity($user);
}
\Yii::$app->response->redirect(\Yii::$app->user->returnUrl);
},
],
],
],
Unfortunately this creates a 500 internal server error. With no error trace, I'm not sure how to debug this.
How do I even begin to tackle this problem?
Upvotes: 0
Views: 8951