Answer the question
In order to leave comments, you need to log in
Authorization in Yii stopped working after changing VPS?
In continuation to Why does the server have some left hostname?
Authorization stopped working. The problem is that after successful validation, a redirect to the main page occurs, but authorization does not occur. And in the firebug console, the following oddities:
In response to the post-request, some left phrase comes "Reload the page to get the source for: http://site.ru/login"
AuthController controller code:
public function actionLogin() {
if (!Yii::app()->user->isGuest)
$this->redirect(Yii::app()->homeUrl);
$user = new User(User::SCENARIO_LOGIN);
$request = Yii::app()->request;
/*$ajaxRequest = $request->getPost('ajax', false);
if ($ajaxRequest && $ajaxRequest === 'login-form') {
echo CActiveForm::validate($user);
Yii::app()->end();
}*/
$formData = $request->getPost(get_class($user), false);
if ($formData) {
$user->attributes = $formData;
if ($user->validate()) {
Yii::app()->user->setFlash('success', 'Welcome back, ' . Yii::app()->user->email . '!');
//$this->redirect(Yii::app()->user->returnUrl);
$this->redirect(Yii::app()->homeUrl);
}
}
$this->pageTitle[] = Yii::t('site', 'Login');
$this->render('login', compact(array('user')));
}
Answer the question
In order to leave comments, you need to log in
That's right, the code section is being executed
if ($user->validate()) {
Yii::app()->user->setFlash('success', 'Welcome back, ' . Yii::app()->user->email . '!');
//$this->redirect(Yii::app()->user->returnUrl);
$this->redirect(Yii::app()->homeUrl);
}
Check php write permissions in the sessions folder. On centos by default /var/lib/php/sessions
Where does authorization take place? There is no identity creation or authentication in action. The fact that the form has been validated does not mean that authorization has occurred. Or is it in your model in the login validation?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question