Reputation: 10548
I've just installed Yii2-User module/Dektrium to my Yii2-app-basic application by this command
composer require "dektrium/yii2-user:0.9.*@dev"
config/console.php
return [
.
.
'modules' => [
'gii' => 'yii\gii\Module',
'user' => [
'class' => 'dektrium\user\Module',
],
],
.
.
]
config/web.php
'components' => [
.
.
/*
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
*/
'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
],
],
.
.
]
After that, i run this command $ php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrations
for updating database schema .
But, when i run http://localhost/mylawsuit/yii/web/index.php?r=user/registration/register
in my browser. It throws error:
Invalid Configuration – yii\base\InvalidConfigException
The configuration for the "modules" component must contain a "class" element.
Screenshot of Error
And, when i'm changing web.php
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
/*
'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
],
],
Typing http://localhost/mylawsuit/yii/web/index.php?r=user/registration/register
in my browser, it shows
Not Found (#404)
Page not found.
Screenshot
I'm not getting where i'm doing mistake. Please help me to rectify.
Upvotes: 4
Views: 7065
Reputation: 1
If u rewrote user model and ['/user/security/login'] redirecting to '/user/login' with 404, open web config and look for 'urlManager' component. If you have enblePrettyUrl on, look on rules. The problem is there - change it or delete.
Upvotes: 0
Reputation: 10548
I Got answer.
I wrote 'modules'=>[...]
inside 'components'=>[...]
, which was wrong.
Now, config/web.php
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
.
.
.
],
'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
],
],
'params' => $params,
Now, it's working fine.
Upvotes: 3