Zen Cart Logo
Forums / General Questions / 10 hours and counting... Account Synchronization?

10 hours and counting... Account Synchronization?

Locked

Views: 724

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
6 Jul 2007, 9:03 AM
#1
morbidkoder avatar

morbidkoder

New Zenner

Join Date:
Jul 2007
Posts:
3
Plugin Contributions:
0

10 hours and counting... Account Synchronization?

Okay.. So this is the situation... I have spent the last 10 hours trying to find a way to automatically create an account in ZenCart when a user creates an account on the main .NET application.

This account will also need to be logged in at the same time the user logs in to the parent site, so that they will not need to log in twice.

I have tried everything I can think of, and over my deadline trying to get this to work. It doesnt seem like too strange of a thing to do does it? I would just manually insert the user into mySql, however the Password Hashing will not match the password hashing of my site.

Please? any ideas?

6 Jul 2007, 10:54 AM
#2
morbidkoder avatar

morbidkoder

New Zenner

Join Date:
Jul 2007
Posts:
3
Plugin Contributions:
0

Re: 10 hours and counting... Account Synchronization?

well.. hot damn.. =)

DROP PROCEDURE IF EXISTS insertCustomerUpdatePassword;
delimiter //

create procedure insertCustomerUpdatePassword

-- Inserts a new user into the Customer Table.

(
_email varchar(255),
_password varchar(80),
_firstName varchar(30),
_lastName varchar(30),
_address varchar(255),
_telephone varchar (20)

)
begin
declare _hashed_pass varchar(255);
set _hashed_pass = concat(md5(concat(substring(md5(_password),1,2) , _password)) , ':' , substring(md5(_password),1,2));

if (select count(*) from zencart.customers where customers_email_address = _email > 0 ) then
select -1; -- email already exists in db
else
insert into zencart.customers
(customers_email_address, customers_password, customers_firstname, customers_lastname,customers_address,customers_telephone )
values
(_email, _hashed_pass, _firstname, _lastname,_address,_telephone );
select LAST_INSERT_ID(); -- success
end if;
commit;
end;
//

delimiter ;