Couldn't find existing issue so I decide to create new one. I just quote beginning of issue found on ubercart.org site.

Can't get to review page

I'm testing our ubercart module and I can't seem to get to the review page. Every time I hit the check out button and the button of the page I get this error "To protect our customers from identity theft, credit card details are erased when a browser refreshes on the checkout review page. Please enter your card details again and re-submit the form." (...)

The problem basically occur when you accidentally leave new line (or whatever whitespace / tab/ newline/ etc.) on the end (or in the beginning) in your uc_credit.key secret file. It's really hard to spot and system doesn't give any useful information except misleading above message: "To protect our customers from ...".

So my solution is simple just trim() every whitespace from the beginning and end of the key, after loading.

Patch in attachment.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sobi3ch’s picture

Status: Active » Needs review

Forget to set proper status..

TR’s picture

OK, we can do that. But how did you get whitespace in your key file? The contents are generated automatically by Ubercart, so unless you edited the file and added the whitespace this should never happen. If Ubercart is generating key files with whitespace, then we ought to do more than just trim() here, we ought to fix the key file generation code.

TR’s picture

Priority: Normal » Minor
Status: Needs review » Postponed (maintainer needs more info)
sobi3ch’s picture

Status: Postponed (maintainer needs more info) » Active

Hi, ok my flout. I've just copy&paste my previous uc_creadit.key, and my editor is adding for default "\n" new line character. Now I see in the code I need to provide only directory path for credit key and ubercart doing rest for me. But still it will be nice if ubercart could handle this problem automatically.

What's your thoughts?

longwave’s picture

Rather than using trim() we should probably throw an error if the uc_credit.key file is not exactly 32 bytes long.

longwave’s picture

Title: Can't get to review page » Can't get to review page if uc_credit.key contains whitespace
sobi3ch’s picture

agree, I'll role path asap..

longwave’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Active » Needs review
FileSize
1.04 KB

Patch for 7.x that simplifies uc_credit_encryption_key() while adding this check.

longwave’s picture

Version: 7.x-3.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

Committed to 7.x-3.x, needs porting to 6.x-2.x.

longwave’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.04 KB
longwave’s picture

Status: Needs review » Fixed

Committed to 6.x-2.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.