Open nakarin4350 opened 2 years ago
If you have already created an user admin
via the console command, you will not be able to use the example migration to create another admin
user with different password.
The example migration is an example of how to create a new (non-existing) user.
if you already have an user with username admin
, you can not add another one with the same name.
Migration will work for you if you do not have that user created already.
If you wish to change the passwords of existing users see https://yii2-usuario.readthedocs.io/en/latest/install/console-commands/ for changing them via console
What steps will reproduce the problem?
I use yii2 basic template and follow installation(https://yii2-usuario.readthedocs.io/en/latest/) and add admin user(https://yii2-usuario.readthedocs.io/en/latest/helpful-guides/first-steps/) with no errors.
What is the expected result?
Can log in with admin/verysecret
What do you get instead?
Cant login with admin/verysecret(Incorrect username or password.) but still can login with admin/admin and demo/demo.
web.php `<?php
$params = require DIR . '/params.php'; $db = require DIR . '/db.php';
$config = [ 'id' => 'basic', 'basePath' => dirname(DIR), 'bootstrap' => ['log'], 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', ], 'modules' => [ 'user' => [ 'class' => Da\User\Module::class, 'administrators' => ['admin'], ] ], 'components' => [ 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => '4RMpBfMQ8yb074gLRuGvihlTyOzfLAps', ], 'cache' => [ 'class' => 'yii\caching\FileCache', ], // 'user' => [ // 'identityClass' => 'app\models\User', // 'enableAutoLogin' => true, // ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', // send all mails to a file by default. You have to set // 'useFileTransport' to false and configure transport // for the mailer to send real emails. 'useFileTransport' => true, ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'db' => $db, 'authManager' => [ 'class' => 'Da\User\Component\AuthDbManagerComponent', ], / 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ ], ], / ], 'params' => $params, ];
if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', // uncomment the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.0.1', '::1'], ];
}
return $config; `