Yii-User And Password Pattern During User Registration

Hello. I’m using yii-user extension. Everything is fine except this one thing: i want to implement password pattern during user registration. So i added this line to model RegistrationForm:




	public function rules() {

		$rules = array(

array('password', 'match', 'pattern' => '/^.*(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\W]).*$/u','message' => UserModule::t("my message."))

)

} 



It validates ok only when using ajax validation - before click button to register user. When i click button to register user i have message that password is not ok - that’s why because my password is returned in hashed form, which contain only small letters and numbers.

Below is my short code of controller registrationform and model registrationform:




Controller:


<?php


class RegistrationController extends Controller

{

public function actionRegistration() {

$model = new RegistrationForm;

// ajax validator

if(isset($_POST['ajax']) && $_POST['ajax']==='registration-form')

{

echo UActiveForm::validate(array($model,$profile));

				Yii::app()->end();

}

			

if (Yii::app()->user->id) {

$this->redirect(Yii::app()->controller->module->profileUrl);

} else {

if(isset($_POST['RegistrationForm'])) {

$model->attributes=$_POST['RegistrationForm'];

if($model->validate())

{

$model->password=UserModule::encrypting($model->password);

$model->verifyPassword=UserModule::encrypting($model->verifyPassword);

}

$this->render('/user/registration',array('model'=>$model,'profile'=>$profile));

		    }

	}

}






Model registrationform:

<?php


class RegistrationForm extends User {     

	public function rules() {

		$rules = array(

array('password', 'match', 'pattern' => '/^.*(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\W]).*$/u','message' => UserModule::t("Hasło musi zawierać duże litery, małe litery, cyfry lub znak specjalny.")),                    

}



Many thank.

Greetings

Tom