Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant login. #452

Open
nakarin4350 opened this issue Apr 5, 2022 · 1 comment
Open

Cant login. #452

nakarin4350 opened this issue Apr 5, 2022 · 1 comment

Comments

@nakarin4350
Copy link

nakarin4350 commented Apr 5, 2022

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'],
];

$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
    'class' => 'yii\gii\Module',
    // uncomment the following to add your IP if you are not connecting from localhost.
    //'allowedIPs' => ['127.0.0.1', '::1'],
];

}

return $config;
`

@TonisOrmisson
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants