Using Useridentity How To Redirect Another Page

In user Identity check the username and password the error will display in the form and also in login model we have to given adderror functionality .

My requirement is,

Foe example,

I have checking condition with 5 errors are there.if certain errors will come ,I want redirect the page .Some errore will come i didn’t want that only display the error enough.

how do i do that .Any one know help me… :(

in useridentity’s authenticate method if authentication is successful then we set

[color="#006400"]$this->errorCode= self::ERROR_NONE;[/color]

in LoginForm Model’s login action we get this errorCode using

[color="#006400"]$this->_Identity->errorCode === UserIdentity::ERROR_NONE[/color]

after getting this errorcode, we set session

[color="#006400"]$duration = $this->RememberMe ? 3600 * 24 * 30 : 0; // 30 days Yii::app()->user->login($this->_Identity, $duration);[/color]

and send it to Controller’s login action.

after getting this value in controller, we redirected it to index.php

in your case, set errorCode in variable then pass this variable to LoginForm Model, then check the value of variable. if it is redirectable value then send it to controller for redirect otherwise display the error in the existing page. :) :)

Thank u 4 ur reply, Ravi hirani

public function login() {


	if ($this -> _identity === null) {


		$this -> _identity = new UserIdentity($this -> username, $this -> password);


		$this -> _identity -> authenticate();


	}


	if ($this -> _identity -> errorCode === UserIdentity::ERROR_NONE) {


		$duration = $this -> rememberMe ? 3600 * 24 * 30 : 0;


		// 30 days


		Yii::app() -> user -> login($this -> _identity, $duration);


		return true;


	} else {


		$warning = $this -> _identity -> warning;


		switch($this->_identity->errorCode) {


			case UserIdentity::ERROR_USER_INTER_MEDIATE_ACTIVATED :


				$this -> addError('username', 'You are not completed Sign up!' . $warning);


				break;


			case UserIdentity::ERROR_USER_NOT_ACTIVATED :


				$this -> addError('username', 'You are un verified user.Please verify your email!' . $warning);


				break;


			case UserIdentity::ERROR_PASSWORD_INVALID :


				$this -> addError('username', 'Invalid password' . $warning);


				break;


			case UserIdentity::ERROR_USERNAME_INVALID :


				$this -> addError('username', 'Invalid email id or password' . $warning);


				break;


			case UserIdentity::ERROR_PASSWORD_RESET_REQUESTED :


				$this -> addError('username', 'Change password requested' . $warning);


				break;


			case UserIdentity::ERROR_REACHED_MAX_FAILED_ATTEMPT :


				$this -> addError('username', 'Your account has been locked!' . $warning);


				$this -> lockUserAccount($this -> _identity -> username);


		}


		return false;


	}


}

In that i want ,in 1st case i want to redirect another page .

And remaining error case i want show in same page i.e loginform.

How do i do it plz …reply :(