4

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

enter image description here

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

enter image description here

I'm not getting where i'm doing mistake. Please help me to rectify.

Nana Partykar
  • 10,556
  • 10
  • 48
  • 77
  • Hey @InsaneSkulll, thanku for giving suggestion. I got answer. I wrote modules inside components which was wrong actually. – Nana Partykar Oct 12 '15 at 11:10

2 Answers2

3

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.

Nana Partykar
  • 10,556
  • 10
  • 48
  • 77
  • I was following the instructions at the documentation https://xdsoft.net/jodit/examples/intergration/yii-jodit.html but they not specify where to add the module. Thank you, this work for me too. – P. Dev Apr 26 '19 at 16:34
0

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.

  • Welcome to Stack Overflow. Your answer is not very clear as it currently is. I would suggest adding some additional code to help the questioner and future users to solve this problem. – buczek Apr 13 '16 at 18:40