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

can not auth #481

Open
damirqa opened this issue Jun 26, 2023 · 1 comment
Open

can not auth #481

damirqa opened this issue Jun 26, 2023 · 1 comment

Comments

@damirqa
Copy link

damirqa commented Jun 26, 2023

Hello. in the authorization controller, I can log in. but when i go to another page my user is not authorized
Yii::$app->user->identity === null => true

`<?php

$params = require DIR . '/params.php';
$db = require DIR . '/db.php';

$config = [
'id' => 'basic',
'basePath' => dirname(DIR),
'bootstrap' => ['log'],
'language' => 'ru',
'modules' => [
'rbac' => [
'class' => 'mdm\admin\Module',
'layout' => '@app/views/layouts/rbac.php',
'controllerMap' => [
'assignment' => [
'class' => 'app\controllers\rbac\AssignmentController',
'idField' => 'id',
'usernameField' => 'username'
],
'route' => ['class' => 'app\controllers\rbac\RouteController'],
'permission' => ['class' => 'app\controllers\rbac\PermissionController'],
'role' => ['class' => 'app\controllers\rbac\RoleController'],
'user' => ['class' => 'app\controllers\rbac\UserController']
]
],
'admin' => [
'class' => 'app\modules\admin\Module',
'layout' => 'admin.php'
]
],
'container' => [
'definitions' => [
\yii\widgets\LinkPager::class => \yii\bootstrap4\LinkPager::class,
]
],
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'as access' => [
'class' => 'mdm\admin\components\AccessControl',
'allowActions' => [
'site/*',
]
],
'components' => [
'authManager' => [
'class' => 'yii\rbac\DbManager'
],
'i18n' => [
'translations' => [
'rbac-admin' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@mdm/admin/messages',
'sourceLanguage' => 'ru'
]
]
],
'formatter' => [
'class' => 'yii\i18n\Formatter',
'locale' => 'ru-RU',
'defaultTimeZone' => 'Europe/Moscow',
'timeZone' => 'GMT+3',
'dateFormat' => 'd MMMM Y',
'datetimeFormat' => 'HH:i:s d/M/Y',
'timeFormat' => 'HH:i:s',
],
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => '_CQG_7Mqoxt5uxULlmM4xW-JlJQcW-pB',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'mdm\admin\models\User',
'loginUrl' => ['rbac/user/login'],
'enableSession' => 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 a transport
// for the mailer to send real emails.
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.yandex.ru',
'port' => '465',
'encryption' => 'ssl',
]
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => $db,

    'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
        ],
    ],
    'reCaptcha' => [
        'name' => 'reCaptcha',
        'class' => 'himiklab\yii2\recaptcha\ReCaptchaConfig',
        'siteKeyV3' => '6Leo6XYgAAAAAIS7dLs0o0VC9zRsVLNYsXr6VTUA',
        'secretV3' => '6Leo6XYgAAAAAOQckqI_qmKUI5EtEa0QDxKiGQ8A',
    ],
],
'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['as access']['allowActions'] = [
    'site/*',
    'callback/*',
    'rbac/*',

// 'admin/',
// 'gii/
',
// 'direction/*'
];

$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;`

@shuanzia
Copy link

hey bro, the configuration you sent leaked your email account password information!

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