This topic is locked
[SOLVED]

 Non Case-Sensitive Login

12/16/2010 20:15:50
ASPRunnerPro General questions
L
larry.dompierre author

ASPRunnerPro 6.3 Build 6843
Hi,
I've browsed the forums and the knowledge base and was unable to find a solution. I would like users to be allowed to login without case sensitive email and password. Any help appreciated.
Larry Dompierre

M
Maurits 12/17/2010



ASPRunnerPro 6.3 Build 6843
Hi,
I've browsed the forums and the knowledge base and was unable to find a solution. I would like users to be allowed to login without case sensitive email and password. Any help appreciated.
Larry Dompierre


edit the login.asp script

edit strSQL =

use UCASE() to compare both, the user login and password and the stored values in the database

J
Jane 12/17/2010

Hi,
this task can be accomplished editing generated login.asp file only.

Find and edit SQL query manually in this file.
Unfortunately we don't have a ready to go solution for this.

L
larry.dompierre author 12/17/2010

Thanks for the responses. I've tried several different things pertaining to your suggestion and I'm not sure where I'm going wrong here- I can run the Following SQL Statement and Match it in the MDB SQL editor, but can not seem to get the login to work...
strSQL = "select UCASE([Email]) AS UEmail, [Password] from " & CSmartStr(AddTableWrappers("TContacts")) & " where [Email]=" & UCASE(CSmartStr(strUsername)) & " and " & CSmartStr(AddFieldWrappers(cPasswordField)) & "=" & CSmartStr(strPassword)
I can't figure out exactly how to work it within your code and just get the message "Invalid Login"
I would like to, if possible, not go into storing the login registration, so users can see what they orignally wrote (John@test.com instead of JOHN@test.com). Any suggestions?
Thanks

M
Maurits 12/18/2010



Thanks for the responses. I've tried several different things pertaining to your suggestion and I'm not sure where I'm going wrong here- I can run the Following SQL Statement and Match it in the MDB SQL editor, but can not seem to get the login to work...
strSQL = "select UCASE([Email]) AS UEmail, [Password] from " & CSmartStr(AddTableWrappers("TContacts")) & " where [Email]=" & UCASE(CSmartStr(strUsername)) & " and " & CSmartStr(AddFieldWrappers(cPasswordField)) & "=" & CSmartStr(strPassword)
I can't figure out exactly how to work it within your code and just get the message "Invalid Login"
I would like to, if possible, not go into storing the login registration, so users can see what they orignally wrote (John@test.com instead of JOHN@test.com). Any suggestions?
Thanks


PLease try this to get your login to work...

Edit the login.asp ... find this part of code:

if IsEqual(GetRequestValue(RequestForm(),"btnSubmit"),"Login") and bValue(logacc) then

if IsEqual(GetRequestValue(RequestForm(),"remember_password"),1) then

asp_setcookie "username",pUsername,CSmartDbl(time())+(365*1440)*60

asp_setcookie "password",pPassword,CSmartDbl(time())+(365*1440)*60

rememberbox_checked = " checked"

else

asp_setcookie "username","",CSmartDbl(time())-(365*1440)*60

asp_setcookie "password","",CSmartDbl(time())-(365*1440)*60

rememberbox_checked = ""

end if

*** strUsername = CSmartStr(UCase(pUsername))

*** strPassword = CSmartStr(UCase(pPassword))

doAssignment sUsername,strUsername

doAssignment sPassword,strPassword

if bValue(NeedQuotes(cUserNameFieldType)) then

strUsername = ("'" & CSmartStr(db_addslashes(strUsername))) & "'"

else

strUsername = 0+CSmartDbl(strUsername)


Change *** to the above code UCase(...)
Also edit/add BeforeRegister in the events tab:

Function BeforeRegister(userdata,message)
userdata("Email") = UCase(userdata("Email"))

userdata("Password") = UCase(userdata("Password"))
BeforeRegister=true


For your second question: I think you mean "logged in as:" on the top of every page.
You have to edit in the events tab, edit AfterSuccessfulLogin:

Function AfterSuccessfulLogin(username,password,data)
SESSION("UserID") = LCase(SESSION("UserID"))


I use LCase() for this as it looks better than using UCase() for email addresses.
Hope this is helpful