12 replies [Last post]
madwinchester's picture
Offline
Joined: 12/04/2007
Juice: 5

I am using Ubercart Alpha 8.

When attempting to purchase something when not logged in, you get the options to enter a username and password to register as a new user. When you fill this in, a new user is created with the email address you have specified, but it does not store the username or the correct password.

I have tracked this down to the uc_paypal_ipn function within uc_paypal.module
The code seems to store the new username in the session as:
$_SESSION['new_user']['name']
and
$_SESSION['new_user']['pass']
And the code within uc_paypal_ipn tries to access the session to get these values.

The problem is that it is the paypal server that is accessing that code, not the user's browser, and therefore it has a different session, which does not contain the new users name or password.

I have searched for a resolution to this but have found nothing. Any help anyone?

Matt Winchester

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Checkout with new user - not storing entered password or use

Good point, Matt. That function is designed to be used by any payment module, but it does rely on the session which just won't work for the others. I'm open for thoughts... maybe it should be stored temporarily somehow w/ the order and removed from the session.

madwinchester's picture
Offline
Joined: 12/04/2007
Juice: 5
Re: Re: Checkout with new user - not storing entered password or

I decided rather than fiddling with extra tables/fields, I would simply make it add the user before sending them off to paypal. So I have added the following code just after line 150 of uc_cart_checkout_pane.inc

$fields = array(
'name' => $_SESSION['new_user']['name'],
'mail' => $arg2['primary_email'],
'init' => $arg2['primary_email'],
'pass' => $_SESSION['new_user']['pass'],
'roles' => array(),
'status' => variable_get('uc_new_customer_status_active', TRUE) ? 1 : 0,
);
$user = user_save('', $fields);
$tmpQuery = db_query("update {uc_cart_products} set cart_id = %d WHERE cart_id = '%s'", $user->uid, session_id());

It appears to work fine. It's probably not the cleanest way to do it as I haven't bothered to remove the code that sets the session vaiables up, but other than that, do you see any potential issues with it?

Kind Regards,

Matt Winchester

WiSeOz's picture
Offline
Joined: 12/05/2007
Juice: 112
Re: Re: Re: Checkout with new user - not storing entered passwor

I am experience this same issue and would like to track the resolution.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Re: Checkout with new user - not storing entered passwor

Matt, your solution works, but you may end up with some extra user accounts from folks that have bailed. Someone may get the wrong message, too, if Ubercart displays something based on new vs. returning users. Not a big deal, though.

WiSeOz's picture
Offline
Joined: 12/05/2007
Juice: 112
Re: Re: Re: Re: Checkout with new user - not storing entered pas

Will this be fixed in Beta 1?

I don't want to apply Matt's fix if it gives orphaned users.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Re: Re: Re: Checkout with new user - not storing entered

You can try that fix or just require users to register before checkout. It will be addressed somehow during beta.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Re: Re: Re: Re: Checkout with new user - not storing ent

Alright... I changed this to store data in the order object itself (thanks to the data array I added to order objects not too long ago!), so this should get completed properly. (Tests were positive for regular checkout with check/money order, PayPal Express Checkout, and PayPal WPS.)

Feel free to grab the latest Bazaar version and try it or hold off for beta 2.

WiSeOz's picture
Offline
Joined: 12/05/2007
Juice: 112
Re: Checkout with new user - not storing entered password or use

I am still experiencing the password issue.

I purchased a membership product. I entered 'UberTester78' for the username and requested a specific password. On the "Order complete" screen, I receive the following:

"Thank you for shopping at WISEOZ. A new account has been created for you that you may use to log in and view your current order status.Click here to login to your new account using the following information:Username: UberTester78Password: URn9mM"

The password shown is not the password I requested. Also, for aesthetics, we could use a comma and a space between the username and password.

I will also log this in your issue queue on drupal.org.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Checkout with new user - not storing entered password or

Hmm... shouldn't need commas as those should be going onto new lines. Might check your input format and add in HTML if you're using the PHP filter. I'm fixing the password thing now.

WiSeOz's picture
Offline
Joined: 12/05/2007
Juice: 112
Re: Re: Re: Checkout with new user - not storing entered passwor

Thanks! Can you let me know when the password thingy is fixed? I assume it will only be available in Bazaar unless you have a new beta coming soon.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Re: Re: Checkout with new user - not storing entered pas

It's available in Bazaar now... beta 7 should be this afternoon. I'm almost done reviewing threads from my absence and making fixes. Cool

WiSeOz's picture
Offline
Joined: 12/05/2007
Juice: 112
Re: Re: Re: Re: Re: Checkout with new user - not storing entered

Thanks! I'll run through my test cases within hours after it's released. With an April 1st go-live, I've got no time to waste.

Oh, and I haven't forgotten you uber guys either. I intend to make donations across the board to the groups that have helped me once I reach April 1st.