Clear password field textbox when browser saved password is enabled


my website has a login system. after user login,they are able to change password. the change password requires user existing password, new password and repeat new password

so the problem is when a user login on firefox, and he chose to save password on the browser. if he goes to change password, the first password field (i.e: existing password) will have the default value as the the password. how can i ensure that all textbox fields are empty under change password

i tried $model->unsetAttributes(‘oldPasswd’) but it doesn’t work.

You can’t do this in any way with Yii. Simply, because everything Yii (PHP) is doing is done on server-side and Firefox password remind is run on your client-side, after server done processing request (that is after Yii end doing everything it should do).

The only solution I would see here is to use jQuery to check value of that field after page has been loaded and parsed (that is: at the very end of processing your request on your client-side). And, if so - to simply remove this.

This might work (not tested this though), if only Firefox Password Manager is not trying to be invisible to HTML document - i.e. setting field value without actually filling it’s value parameter (I wouldn’t be surprised with that, but I don’t like this browser at all! :]).

there is a way, via htmlOptions ‘autocomplete’ => ‘off’

Hm… I’ve never heard about autocomplete parameter of htmlOptions, but I’m still pretty sure, that you can’t control, how client browser works from server side! No, matter, if you are using Yii, pure PHP or any other language / framework to build your webpage.

Autocompleting password field is a feature of Firefox or any other browser and can be turned on or of in browser settings and any server, that hosts your page, has nothing to do with this.