Answer the question
In order to leave comments, you need to log in
How to fix the registration controller on the site?
Hello. I study WEB according to the book. And now I ran into a problem - in the navigation bar, the author suggests not to create a link to enter the site, but to go to it manually by entering the address ("security"). As soon as I pass to the address the error takes off.
Here is the controller:
public function actionLogin()
{
$this->pageTitle = "Вход";
$user = new User("search");
if (isset($_POST['User'])) {
$user->attributes = $_POST['User'];
if ($user->validate()) {
$idetntity = new UserIdentity($user->name, $user->password);
if(($identity->authenticate()) &&
(Yii::app()->user-login($identity))) {
$this->redirect(array("site/index"));
}
}
}
$this->render('login', array('user' => $user));
}
<h1><?php echo CHtml::encode($this->PageTitle); ?> </h1>
<?php if ($this->isMobile) { ?>
<p> Пользователи мобильных устройств не могут войти на сайт.</p>
<?php } else { ?>
<?php echo CHtml::beginForm() ?>
<div class="label"><?php echo CHtml::activeLabelEx($user, "name")
?></div>
<div class="control"><?php echo CHtml::activeTextField($user, "name")
?></div>
<?php echo Chtml::error($user, "name") ?>
<div class="label"><?php echo CHtml::activeLabelEx($user, "password")
?></div>
<div class="control"><?php echo CHtml::activePasswordField($user, "password") ?><div>
<?php echo CHtml::error($user, "password") ?>
<div class="button"><?php echo CHtml::submitButton("Войти"); ?></div>
<?php echo CHtml::endForm() ?>
<?php } ?>
class User extends CActiveRecord
{
public $password2;
...
Answer the question
In order to leave comments, you need to log in
you have a login file "rendered" in your controller $this->render('login', array('user' => $user)); and the error crashes on the fact that it cannot find the "password2" file, without the source code it's hard to understand what's wrong with you
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question