Joe Brinkman recently published a Blog on creating a custom Authentication Provider for DotNetNuke 5 (DotNetNuke Tips and Tricks #12: Creating your own Authentication Provider). However, it won't work for DNN 4. I made a version that will work with DNN4, however, it won't work with DNN 5. I also made it in C# :)
Using the Provider
Log in as the Host account, and from the Host menu select Host Settings.
Expand the Authentication Settings section, and click the Install New Authentication System link.
Install the CustomLogin package.
From the Admin menu, select Authentication.
Check the box next to Enabled under Custom Login Settings and click the Update Settings link.
Log out and then click the Login link. You will now see the option for the Custom Login. You can disable the Standard DNN login back on the Authentication screen and you will then only see the Custom Login.
The point is you can now alter it to create your own custom login logic. Look at the source code for the other Authentication Providers (OpenID ect) to see what is possible.
You can download the package here:
http://www.adefwebserver.com/DotNetNukeHELP/files/CustomLogin_01.00.00_Install.zip