Gossamer Forum
Home : Products : DBMan : Customization :

case insensitive user name

Quote Reply
case insensitive user name
When a person (or an Admin) creates a new user record I need a case insensitive
search to make sure the username isn't already in use. I found a good thread
on that at
http://www.gossamer-threads.com/...e%20username;#181947
(I hope that url works, the subject line is " Re: case sensitive usernames")

A post, dated Aug 13, 1999, by JPDeni, goes into terrific detail on this
and says to make changes in two places: sub change_password and
sub signup but I can't find sub change_password at all.


I am using code dbMan Version: 2.05

In db.cgi I found this (but can't figure out how to change it):

Code:
-------------------------------------------------------------------------------
sub signup {
# --------------------------------------------------------
# Allows a user to sign up without admin approval. Must have $auth_signup = 1
# set. The user gets @default_permissions.
#
my $message;

# Check to make sure userid is ok, pw ok, and userid is unique.
unless ((length($in{'userid'}) >= 3) and (length($in{'userid'}) <= 12) and ($in{'userid'} =~ /^[a-zA-Z0-9]+$/)) {
$message = "Invalid userid: $in{'userid'}. Must only contain only letters and be less then 12 and greater then 3 characters.";
}
unless ((length($in{'pw'}) >= 3) and (length($in{'pw'}) <= 12)) {
$message = "Invalid pw: '$in{'pw'}'. Must be less then 12 and greater then 3 characters.";
}
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1); }
while (<PASS>) {
/^\Q$in{'userid'}\E:/ and ($message = "userid already exists. Please try another.");
}
--------------------


If it's helpful, I've placed my files at
ftp://coral.wcupa.edu/dbman

I appreciate any help any one can give me!
paula
Quote Reply
Re: [paula] case insensitive user name In reply to
The solution was to modify the auth.pl file:

This is the portion of the thread with the solution:

Well, that's a completely different question that what you asked before.

Look in auth.pl for code:

if (($in{'userid'} eq $userid) && (crypt($in{'pw'}, $pw) eq $pw)) {

change it to code:

if ((lc($in{'userid'}) eq lc($userid)) && (crypt($in{'pw'}, $pw) eq $pw)) {

Further down in that same script find code:

if ($username eq $name) {

change that to code:

if (lc($username) eq lc($name)) {

That oughta do it, but I haven't tested it.

---------

the change password portion you mentioned above is if you had that mod installed, if not, you wouldnt' worry about it :)

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] case insensitive user name In reply to
LoisC, thanks much for your help but it didn't work. For example, I had a user in the database named "david" and it did allow a new user to be created named "David".

I was just thinking ... perhaps it would be better to force the creation of any username to be lowercase no matter what the person typed in? I wouldn't mind taking that approach and I'd add a note to the "Create an Account" to the effect that user names will always be forced to lower case.

I have the original files at ftp://coral.wcupa.edu/dbman

I placed the auth.pl with the new edit at
ftp://coral.wcupa.edu/dbman/1loisc


In the new html.pl if you search for "case insensitive" you can see the two changes you suggested. I don't know if you have time or not but if you wouldn't mind taking a look I'd be very grateful!

best,
paula