how to implement htpasswd security on module or controller level

How do I Implement htpasswd on an MVC framework. My client want’s to protect the admin module via htpasswd do I only need to create an htpasswd and htaccess on the admin module folder or is there Yii-way to do this?

See the section Role-Based Access Control in the Yii guide. It’s just what you need.

Yeah that will work for a full authentication system. But we just need the simplicity of prompting a user password box just like how htpasswd works. Should I resort to javascript :(

Ah, okay. The gii-module has got a built-in password mechanism. You might want to have a look at that.

If everything else fails: htpasswd authentication should work within Location-context (assuming you’re using the Apache webserver).

thank you that’s what I need