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

Mike Heins interchange-users@icdevgroup.org
Thu Oct 17 17:17:01 2002


Quoting Ron Phipps (rphipps@reliant-solutions.com):
> > > 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
> > 
> 
> I just verified this works as you described, looks good :)
> 
> > 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.
> 
> If you would like to use an integer you will need to initialize
> etc/username.counter to an integer greater then 9, otherwise the
> creation of the first 10 users fail since it expects at least a 2
> character username.
> 
> Another issue that I will resolve soon is if you do the indirect login
> and then try to change your email address in the account maintenance
> screen to an email address that already exists it dies silently.  If you
> change your email to an address that does not exist it will save as
> expected.

Your patch will be appreciated. ;-)

> 
> The right way to probably fix this is in the userdb save code check if
> indirect login is being used and if so then verify that the value being
> saved is unique otherwise throw an error that the value is not unique.
> 

There is another issue as well, which I just encountered with a client.
If you are not requiring customers log in before placing an order (if you
want me as an e-commerce customer that is necessary) then you need to
create a new userdb profile for the auto-created user. Otherwise a
duplicate email address will cause the autocreation code to faile.

So what I would recommend is:

UserDB    autocreate    crypt         0
UserDB    autocreate    time_field    mod_time
UserDB    autocreate    scratch       "dealer price_level credit_limit"

Then in etc/log_transaction, add profile=autocreate to the
parameters for the new_account creation:

		[userdb
			function=new_account
			assign_username=1
			password='[value zip]'
			verify='[value zip]'
			profile=autocreate
		]

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

Few blame themselves until they have exhausted all other possibilities.
 -- anonymous