Forums / Upgrading from 1.3.x to 1.3.9 / Security Token vs my mod

Security Token vs my mod

Locked

Started by sanji on 29 Dec 2007, 1:26 AM · Views: 3,381

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
29 Dec 2007, 1:26 AM
#1
sanji avatar

sanji

Zen Follower

Join Date:
Jan 2005
Posts:
138
Plugin Contributions:
0

Security Token vs my mod

I have a small problem with the concept of securityToken, and I hope you can bring me some light!

I understand that this securityToken is sent together with the login and password to prevent fraudulent identification, but I don't get where theat token is generated.

In my case, I try to adapt the login_as_customer module, which allow an admin to click on a button to directly login in the catalog part of the shop using the customer's email and the master password.

Information is sent that way :

<form target="_blank" name="login" action="' . $login_as_customer . '" method="get">
<input type="hidden" name="email_addr" id="login-email-address" value="' . $email_address . '">
<input type="hidden" name="password" id="login-password" value="' . $pass . '">
<input type="image" src="' . $place_order_button . '">
</form>

I would expect the following to work with 1.3.8a :

<form target="_blank" name="login" action="' . $login_as_customer . '" method="get">
<input type="hidden" name="email_addr" id="login-email-address" value="' . $email_address . '">
<input type="hidden" name="password" id="login-password" value="' . $pass . '">
' . zen_draw_hidden_field('securityToken', $_SESSION['securityToken']) . '
<input type="image" src="' . $place_order_button . '">
</form>

(the code might look a little strange, it is in fact only an abstract of a long string sent, but it is working - no parse error)

But this seems not to work. Do I have a problem with the way I generate the token??

Thanks,

sanji

29 Dec 2007, 1:35 AM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Security Token vs my mod

Sanji

Don't worry about how the security token is generated. Rather your problem looks to me to be that your form is using the get method for passing information, but Zen Cart is expecting to receive the security token in the $_POST array.

Indeed, I'm not sure that you can pass hidden variables with the get method as they are visibly tagged onto the URL.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

29 Dec 2007, 2:13 AM
#3
sanji avatar

sanji

Zen Follower

Join Date:
Jan 2005
Posts:
138
Plugin Contributions:
0

Re: Security Token vs my mod

Thanks Kuroi, I tried both post and get methods, but the result is exactly the same...

sanji

29 Dec 2007, 2:29 AM
#4
sanji avatar

sanji

Zen Follower

Join Date:
Jan 2005
Posts:
138
Plugin Contributions:
0

Re: Security Token vs my mod

This is the way the information is sent for login, with post :

<form name='form1' action='/index.php?main_page=login&action=process' method='post'>
<input type='hidden' name='email_address' id='login-email-address' value='[email protected]' />
<input type='hidden' name='password' id='login-password' value='12345678' />
<input type='hidden' name='securityToken' id='securityToken' value='xxxxxxxx49eb4cdfd90ba277c409aa22' />
<input type='submit' value='Place Order' />
<input type='button' value='Cancel Order' onclick='window.close()'>
</form>

Does that look OK? I still get that Security Error...

sanji