[ic] Use E-Mail Address Instead Of Username For Login

Mike Heins interchange-users@icdevgroup.org
Sun Oct 13 00:09:01 2002


Quoting Mike Heins (mike@perusion.com):
> Quoting Matthew Villa (matt@1percent.com):
> > I want the customer to login by specifying their e-mail address not
> > their username. I basically need a login screen similar to NetFlix and
> > Amazon.
> > 
> > I need to modify the registration form so they don't specify their
> > username. Instead, they specify their e-mail address and their password
> > on the registration form.
> > 
> > I am assuming that I will need to have the system to assign a user id to
> > their account automatically so it's used as a unique identifier for
> > their account.
> > 
> > If anyone can help me out that would be wonderful. Thanks in advance.
> 
> Can't help you with 4.8 other than point you to search for "unique"
> in recent list postings at Google.
> 
> With 4.9, there is a new indirect login capability. It automatically
> checks that for uniqueness, and allows you to assign a customer number 
> automatically. To use it, you need in catalog.cfg:
> 
> UserDB    default    indirect_login  email
> UserDB    default    assign_username 1
> UserDB    default    sql_counter     userdb:custno
> 
> You can omit the sql_counter parameter if you don't want to use 
> a sequence in your database to create the user number. Otherwise,
> create a sequence as described in the sql_counter docs (4.9) for
> the counter tag.

Looking at this, it is unclear what I said. The capability works
fine if you just put:

 UserDB    default    indirect_login  email
 UserDB    default    assign_username 1

It then just uses the normal "etc/username.counter" file and
starts the numbers at U00001. You don't even need sql_counter
to do integer numbers if you initialize etc/username.counter
with an integer.

Also, to forestall what might be common questions -- no changes
to login forms are needed. You still use mv_username, etc.

As I think about it, I think I did this on a 4.8 catalog with:

[if type=data term="userdb::username::[cgi mv_username]"]
	# do nothing, they used their customer number
[else]
    [tmp indirect][data table=userdb column=username foreign=email key="[cgi mv_username]"][/tmp]
    [if scratch indirect]
        [calc]
            $CGI->{mv_username} = $Scratch->{indirect};
            return;
        [/calc]
    [/if]
[/else]
[/if]
[if type=explicit compare="[userdb login]"]
mv_nextpage=[either][cgi mv_successpage][or][cgi mv_nextpage][/either]
[else]
mv_nextpage=[either][cgi mv_failpage][or][cgi mv_nextpage][/either]
[/else]
[/if]
 
In that case, you of course have to run a unique check on the email
address before login. But you can still use "assign_username" to
assign the customer number.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

Unix version of an Outlook-style virus:
It works on the honor system. Please forward this message to everyone
you know, and delete a bunch of your files at random.