schuchert wrote: |
| Is it possible to set the module to look for just the username portion of the login and not the domain\username format? Can i hardcode the "domain\" somewhere? If so, where? |
|
Back in the second thread for Tam's module (
http://forums.asp.net/1065878/ShowPost.aspx), Caelen98 was able to "hardcode" by using the following;
>>Back to the hidden domain question, is there a way to capture the username from Tam's Authentication Login Page, set a variable up, and tack the domain\+username together and pass that on during the submission?<<
This is how I did it.... In the AuthenticationSignin.ascx, I put the following at the top of the code:
<script runat="server">
Sub change(sender As Object, e As EventArgs)
txtUsername.Text="oldplacerville\" & txtUsername.Text
End Sub
</script>
Then, I updated the following line:
<td colspan="2" align="center"><asp:textbox id="txtUsername" ontextchanged="change" columns="9" width="130" cssclass="NormalTextBox" runat="server" /></td>
(adding ontextchanged="change") which calls the top script.
This has worked well for me.
The one thing you need to watchout for doing these changes is that when you go to login to the site, the changes will append the "domain name\" at the front. Host and Admin included!!! The way I got around that was to update Caelen98's first change by adding an ElseIf statement.
<script runat="server">
Sub change(sender As Object, e As EventArgs)
if txtUsername.Text="admin" then
txtUsername.Text="admin"
elseif txtUsername.Text="host" then
txtUsername.Text="host"
else txtUsername.Text="yourdomain\" & txtUsername.Text
end if
end sub
</script>
This was able to let me preserve the Host and Admin account. I just tried these changes with 3.2 and things worked like a charm. The file to modify is \admin\Security\Signin.ascx Just don't forget the ElseIf statements so you can still get in with the Admin and Host accounts.
Hope this helps