Zen Cart Logo
Forums / Fraud Prevention / How to disable customers automatic login after account creation?

How to disable customers automatic login after account creation?

Locked

Views: 2,523

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
23 Jun 2008, 11:29
#1
mrtorrez avatar

mrtorrez

New Zenner

Join Date:
Aug 2006
Posts:
74
Plugin Contributions:
0

How to disable customers automatic login after account creation?

Hi,

I'm setting up zen-cart not for shop purposes.
Visitors can create an account.
So far so good.

However, after a visitor has created an account he/she will be logged in automatically. How can I disable this?

I've tried the following:

  • admin > customers > Customer Approval Status - Authorization Pending=1

and

removed the following lines in includes/modules/mytemplate/create_account.php
aprox. starting at line 344

if (SESSION_RECREATE == 'True') {
zen_session_recreate();
}

$_SESSION['customer_first_name'] = $firstname;
$_SESSION['customer_default_address_id'] = $address_id;
$_SESSION['customer_country_id'] = $country;
$_SESSION['customer_zone_id'] = $zone_id;
$_SESSION['customers_authorization'] = $customers_authorization;

// restore cart contents
$_SESSION['cart']->restore_contents();

// hook notifier class

$zco_notifier->notify('NOTIFY_LOGIN_SUCCESS_VIA_CREATE_ACCOUNT');

This didn't work.
Your help will be appreciated:smartalec:

grmx

23 Jun 2008, 15:14
#2
mrtorrez avatar

mrtorrez

New Zenner

Join Date:
Aug 2006
Posts:
74
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

GOT IT!

inserted

$_SESSION['customer_id']='';

somewhere in includes/modules/mytemplate/create_account.php

grmx

24 Jun 2008, 01:26
#3
justmetoo avatar

justmetoo

Zen Follower

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

Instead of touching the code, did you try to set up your shop to require approval before the customer can actually shop?

If you want the customer to be able to see the products, before creating an account and then create an account and have to be approved to buy, then you can use the setting in Customer Details for:

Customer Approval Status - Authorization Pending
Customer must be Authorized to shop
0= Not required
1= Must be Authorized to Browse
2= May browse but no prices unless Authorized
3= Customer May Browse and May see Prices but Must be Authorized to Buy

It is recommended that Option 2 or 3 be used for the purposes of Spiders

3 is probably the one that would work best for you.

If you try to test this on an existing account, be sure not to be logged in and to set the exist authorization to disabled in the Customers.

24 Jun 2008, 07:00
#4
mrtorrez avatar

mrtorrez

New Zenner

Join Date:
Aug 2006
Posts:
74
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

Thanks Justmetoo.

I've tried your options already before, but they didn't take the effect I want.

Customers will be immediately logged in after they have created an account. (very logical because in this way they can edit their account-data afterwards)

As I mentioned before it's no shop for what I use Zen-cart for. So for me their is absolute no need that customers will be logged in , except for creating an account (for other purposes). After account-creation I want them immediately be logged-off.

grmx

24 Jun 2008, 13:45
#5
justmetoo avatar

justmetoo

Zen Follower

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

While they are immediately logged in, they still cannot do anything until approved.

What version of Zen Cart are you using? I think there was a bug that was fixed in v1.3.8 for this setting.

As they cannot do anything until approved, it is the same thing as not being logged in, but they can browse the site and see your products and prices at setting 3.

25 Jun 2008, 06:41
#6
mrtorrez avatar

mrtorrez

New Zenner

Join Date:
Aug 2006
Posts:
74
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

I'm using version 1.38.

You're right, logged in, customers can do nothing. But for example I want to get rid off the header 'log off' and stuff like that when they are logged in.

grmx\

25 Jun 2008, 18:53
#7
justmetoo avatar

justmetoo

Zen Follower

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

If customers cannot buy anything, do they need to login for something?

If not, you could just set the Store up as a Showcase in the My Store configuration settings:

Store Status
What is your Store Status
0= Normal Store
1= Showcase no prices
2= Showcase with prices

Or, if you do need that login feature, you can customize the header template to not display the login.

26 Aug 2008, 06:52
#8
wiseeker avatar

wiseeker

New Zenner

Join Date:
Aug 2008
Posts:
8
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

I have a strong reason to achieve what the initial poster is seeking to do.

I'm planning on sending an activation email (very similar to this ZenCart forum does on creation of new account) and I want the customer to do anything only upon receiving the email and activating the account.

I would really like to know if there is a more graceful way of stopping automatic login after account is created.

Thank you,
WS

26 Aug 2008, 20:05
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to disable customers automatic login after account creation?

I would really like to know if there is a more graceful way of stopping automatic login after account is created.

If I took all the time to create an account ... I sure would expect to be logged in without having to login again right after ... :flex:

Why wouldn't you want to be logged in after taking the time to create an account?

Why would I want to lose everything I was shopping for, prior to creating the account?

Could you perhaps expand on the concept of what you are wanting and why? :smile:

26 Aug 2008, 20:13
#10
wiseeker avatar

wiseeker

New Zenner

Join Date:
Aug 2008
Posts:
8
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

Ajeh:

Why wouldn't you want to be logged in after taking the time to create an account?
Same reason why this ZenCart forum wouldn't let you post as soon as you signed up. Did you have to wait for an email containing activation code? Pretty much same reasoning. We want to validate that the user used his own email id and not someone else's.

Hope this makes sense.

Ajeh:

Why would I want to lose everything I was shopping for, prior to creating the account?

Could you perhaps expand on the concept of what you are wanting and why? :smile:

You wouldn't have anything in your cart 'coz I've configured that on creating new account, customer will have to be authorized and without logging in a customer can browse but not add to cart. :clap:

27 Aug 2008, 04:09
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to disable customers automatic login after account creation?

You didn't say that before ... :cool:

Glad you found the built in features to Zen Cart for authorization will handle all of this without any coding customization ... :smartalec:

27 Aug 2008, 05:19
#12
wiseeker avatar

wiseeker

New Zenner

Join Date:
Aug 2008
Posts:
8
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

Ajeh:

Glad you found the built in features to Zen Cart for authorization will handle all of this without any coding customization ... :smartalec:

Almost! almost!! Looks like there is no graceful way to stop auto login after create account. So, I had to resort to what was shown in the beginning of this thread:

unset($_SESSION['customer_id']);

I don't know if you are part of ZenCart team; I would like to take this opportunity to thank the team for a great customizable product. Thank you. :bigups:

27 Aug 2008, 15:24
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to disable customers automatic login after account creation?

Yes I am part of the Zen Cart Development Team ... :smile:

I am not sure why the Customers must be authorized to buy wouldn't work for you ...

This is designed to allow the create account, but the actual ability to shop cannot happen until the account is authorized by the admin ...

Glad you have a solution that works for you ...

02 Sep 2008, 06:07
#14
n0odle96 avatar

n0odle96

New Zenner

Join Date:
Sep 2008
Posts:
10
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

WiSeeker:

I have a strong reason to achieve what the initial poster is seeking to do.

I'm planning on sending an activation email (very similar to this ZenCart forum does on creation of new account) and I want the customer to do anything only upon receiving the email and activating the account.

I would really like to know if there is a more graceful way of stopping automatic login after account is created.

Thank you,
WS

Hi there!
I am now working on sending email verification before the user can actually buy. I already disabled the automatic login feature of zen-cart by putting zen_session_destroy(); in includes/modules/create_account.php before redirecting to other page.

The problem now is I don't know how to log-in from the link I placed in the verification email.

Could some help me on this?

05 Sep 2008, 02:11
#15
wiseeker avatar

wiseeker

New Zenner

Join Date:
Aug 2008
Posts:
8
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

n0odle96:

The problem now is I don't know how to log-in from the link I placed in the verification email.

I am not sure logging the user in directly from the link is pretty safe. For one thing, email is open to any prying eyes unless it is encrypted.

I don't have the issue you mentioned 'coz I'm only activating the account upon visiting the URL and then I'm letting the user login again.

HTH,
WS

05 Nov 2009, 23:05
#16
nords avatar

nords

New Zenner

Join Date:
Nov 2009
Posts:
1
Plugin Contributions:
0

Re: How to disable customers automatic login after account creation?

Great forum. Been using it alot. I really needed this functionality to. It took me a little to decipher just exactly where to kill the session and just wanted to throw out another easy way to do this.
Search for the line
if (SESSION_RECREATE == 'True')
This is the point where the db is populated and Zen is actually going to create an Authorized Users Session and send e-mail confirms.
I simply added a line above it.
SESSION_RECREATE == 'False'

No session; e-mail and the user goes straight to a success page.
Here I changed the wording to let them know they aren't approved yet and will get an e-mail decission.

Anyway, another way to skin the cat.
Good application. Nice customization.