I am learn UserIdentity but..why '!'

that confused me…somebody help!

and I don’t understand how error code work too, how it transfer into our browser?can you tell me?

thank you~

error code lets you know what the authentication error is (invalid username, invalid password, etc.). Error code 0 means no error. Check the place where you use identity and call its authenticate() method, you will see why.

I agree with the OP, the name ‘errorCode’ is not good, and it’s exposing implementation detail – should it not be protected?

I think the whole stack of:


[*] CBaseUserIdentity extends CComponent implements IUserIdentity

[*] CUserIdentity extends CBaseUserIdentity

[*] UserIdentity extends CUserIdentity


could do with a refactor, personally. As far as I can tell, beyond authentication, anything else should reside with Yii::app()->user. In fact, can’t you just ignore the above stack and just pass Yii::app()->user->login() your own object that implements IUserIdentity?