Dektrium can't open register page


(soyo20) #1

I just install the dektrium extension on Yii2-basic,
I can open then login window , but when I click the link below " Don’t have an account? Sign up!, the browser will redirect to the sign in page immediately.
While I modified the php file of yii2-app-basic\vendor\dektrium\yii2-user\controllers\RegistrationController.php . I found that the constructor can be executed (as I type in some echo in it ) but the actionRegister never be executed.

I had change the variable in module.php of $enableRegistration=true;

I wish you give me the solution thanks


#2

Did you followed instructions from https://github.com/dektrium/yii2-user/blob/master/docs/getting-started.md ?

Open debug panel and check logs, maybe you will found out what causes redirection.

I just installed dektrium extension on fresh yii2-basic installation. Register form can be opened directly or from login page without any problem.

BTW I think it’s not a good idea to edit files in vendor directory. If you need to change behavior of dektrium, read the section Overriding https://github.com/dektrium/yii2-user/blob/master/docs/README.md


(soyo20) #4

Thank you for your reply, I followed the install instructions from the Github webpage of course.
I install the system in two computer , but get the same result :frowning:
I don’t know how to open the debug panel although I had set the
defined(‘YII_DEBUG’) or define(‘YII_DEBUG’,true);
and modified the config\web.php as
‘debug’ => [
‘class’ => ‘yii\debug\Module’,
// uncomment the following to add your IP if you are not connecting from localhost.
‘allowedIPs’ => [’*’]
]

I know that I shouldn’t edit the vendor’s file , I just want to verify what create the problem.


(soyo20) #5

I think that I install the dektrium correctly, because I can open the sign in page by the url as /index.php?r=user/security/login. If I type url as /index.php?r=user/registration/register , it will redirect back to the login page. Also other dektrium actions.
I edited the dektrium\yii2-user\controllers\RegistrationController.php. Added “echo (‘111’);exit;” in the __construt, it will show 111. but if I added them in actionRegister as the first line , it never appeared and redirect to the login page immediately.


#6

You can access debug panel by clicking on Yii logo at the bottom of the page. Debug mode is enabled by default after Yii installation. If you are connecting from another pc you can try to write your IP adress instead asterisk in allowedIPs.
BTW debug component settings should be already present in web.php, look at the end of the file and change allowedIPs setting there.

Change your config file web.php by adding 'trace' to log levels:

'components' => [
...
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning', 'trace'],
                ],
            ],
        ],
...
],

If you want to see what parts of code are executed you can use debug function by calling Yii::debug('your message');. It will be written to log file.

If you still can’t access debug panel you can open log file directly. It is located at runtime/logs/app.log


(soyo20) #7

I had solved this problem. I just reinstall the yii2-basic again. And then I can install yii2-user and run it .

I think that when I install yii2-basic , I probably ignored the section of “–stability=dev”