Even if I type the same passwords in password field and repeat password field, it says that the passwords don’t match and I don’t know what’s wrong.
In my user model, I have defined this in the class (none of these attributes are stored in db, because in the actionRegister I’m hashing the password and storing it hashed):
public $password;
public $repeatPassword;
...
Validation rules for passwords:
array('password', 'required', 'on'=>'insert'),
array('repeatPassword', 'required', 'on'=>'insert'),
array('password, repeatPassword', 'length', 'min'=>6, 'max'=>40),
array('password', 'compare', 'compareAttribute'=>'repeatPassword'),
array('repeatPassword', 'safe'),
My action for registration:
public function actionRegister()
{
$user=new User;
$this->performAjaxValidation($user);
...
In view:
<div class="row">
<?php echo $form->labelEx($user,'password'); ?>
<?php echo $form->passwordField($user,'password')?>
<?php echo $form->error($user,'password'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($user,'repeatPassword'); ?>
<?php echo $form->passwordField($user,'repeatPassword')?>
<?php echo $form->error($user,'repeatPassword'); ?>
</div>
Could you help me please?