Yii Framework Forum: Yii Log In Mozilla Firefox Bug(?) - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii Log In Mozilla Firefox Bug(?) Possible bug founded Rate Topic: -----

#1 User is offline   docc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 07-July 10

Posted 17 December 2013 - 03:36 AM

I have created many Yii applications successfully but recently I have started having problems with login in Yii applications.

The issue appears casually once people try to log in with Mozilla Firefox browser, the log in succeeds with no error messages and user id is stored to: Yii::app()->user-id, but after redirection, everything is gone. In many cases cleaning the browser data solves the problem but I think there should be a better solution. This "bug" does not only appear with Yii applications but my partners keep telling about the problem in few other platforms too.

I have tried to debug the problem but I haven't got any good ideas yet. It just seams that cache memory get confused or messed up. Have anyone else faced this problem?

My login form and useridentity code:



        //THIS IS THE LOGIN FUNCTION THAT IS CALLED IN CONTROLLER. 
	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)
		{
			Yii::app()->user->login($this->_identity);			
			echo Yii::app()->user->id;	//debug row, returns an integer
			die();				//debug row
			return true;
		}
		else
			return false;
	}


       ...........



class UserIdentity extends CUserIdentity
{        
        private $_id;	 
        //THIS IS CALLED BY LOGIN FORM	
	public function authenticate()
	{

        $record=User::model()->findByAttributes(array('username'=>$this->username));   
		//var_dump(md5($this->password));
        if($record===null)
            $this->errorCode=self::ERROR_USERNAME_INVALID;
        else if($record->password!==md5($this->password."SALT"))
            $this->errorCode=self::ERROR_PASSWORD_INVALID;
        else
        {
            $this->_id=$record->id_user;
            $this->errorCode=self::ERROR_NONE;
            
        }
        return !$this->errorCode;		
	
	}
	
	
        public function getId()
        {
            return $this->_id;
        }
}


So, once I have debug rows uncommented, the result is a real integer(an user id), it tries to say login worked I guess. Once debug rows are removed and redirecting is done, the user id is gone too. No session is stored.
And the problem appears casually, I haven't been able to track all the factors which causes the problem but it really happens casually in many different computers, in different operating systems and at least in Firefox browser.

Thanks in advance if someone could give me any hint...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users