E
E
EVOSandru62014-12-15 13:07:26
Yii
EVOSandru6, 2014-12-15 13:07:26

Where in Yii to create a UserIdentity class and call its authenticate method?

Good afternoon, help people who studied this article by Makarov www.yiiframework.ru/doc/guide/ru/topics.auth
It doesn't say where or instead of what to insert this piece in order for authorization to work.

// Аутентифицируем пользователя по имени и паролю
$identity=new UserIdentity($username,$password);
if($identity->authenticate())
    Yii::app()->user->login($identity);
else
    echo $identity->errorMessage;
…
// Выходим
Yii::app()->user->logout();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
krypt3r, 2014-12-15
@krypt3r

To the protected/components directory. And make sure that the config is written

'import' => array (
...
'application.components.*'
);

T
Terminaft, 2014-12-15
@Terminaft

Why don't you use the second version?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question