Here is the patch for email validation during anonymous user checkout process.

CommentFileSizeAuthor
#4 address_2.patch1.89 KBGunny-1
#3 address_1.patch1.69 KBGunny-1
address_0.patch998 bytesGunny-1

Comments

matt westgate’s picture

Status: Reviewed & tested by the community » Needs work

Let's reuse valid_email_address($mail) in common.inc. Care to whip up a fresh patch?

jxs2151’s picture

Trying to patch and getting this message:

patching file address.module
Hunk #1 FAILED at 51.
Hunk #2 FAILED at 95.
2 out of 2 hunks FAILED -- saving rejects to file address.module.rej

I tried it against the 4.6.0 address.module and the cvs address.module

Gunny-1’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.69 KB

Here is the modified patch using valid_email_address($mail). Looks like the cvs version has been updated recently, accordingly i have modified the patch.

Gunny-1’s picture

StatusFileSize
new1.89 KB

The email address was not showing up on the checkout preview form with the previous patch but not anymore with this patch.

jxs2151’s picture

I downloaded the cvs ecommerce module. I then downloaded the address_2.patch and executed patch < address_2.patch and got:

patching file address.module
Hunk #2 FAILED at 64.
1 out of 4 hunks FAILED -- saving rejects to file address.module.rej

address.module.ref contains this:


***************
*** 63,73 ****
        return $output;

      case 'validate' :
-       if ($txn->shippable && !$txn->shipping_address) {
-         form_set_error('shipping_address', t('You need to select a shipping address.'));
-       }
-       if (!$txn->billing_address) {
-         form_set_error('billing_address', t('You need to select a billing address.'));
        }
        break;

--- 64,81 ----
        return $output;

      case 'validate' :
+
+       if ($user->uid > 0) {
+
+           if ($txn->shippable && !$txn->shipping_address) {
+             form_set_error('shipping_address', t('You need to select a shipping address.'));
+           }
+           if (!$txn->billing_address) {
+             form_set_error('billing_address', t('You need to select a billing address.'));
+           }
+           }
+       if ($error = address_validate_mail($txn->mail)) {
+         form_set_error('mail', $error);
        }
        break;

Am I doing something wrong?

Gunny-1’s picture

if you go through the attached patch, its just few lines and you can also see which lines you go to remove (-) and which ones to add (+) in address.module.

I used cygwin patch utility, not sure why its not working in your case. the patch command i used ,

diff -u -F ^function address.module address_2.module > address_2.patch

Gunny-1’s picture

Mathias, i would appreciate if you can review this patch. thanks

jxs2151’s picture

I am a little confused. Does address_2.patch patch the 4.6.3 version of the module or the CVS version?

Eglish’s picture

This looks to be fixed. Here's the code from address.module version 1.37

    case 'validate' :
      if ($user->uid > 0) {
        if ($txn->shippable && !$txn->shipping_address) {
          form_set_error('shipping_address', t('You need to select a shipping address.'));        
        }
        if (!$txn->billing_address) {
          form_set_error('billing_address', t('You need to select a billing address.'));
        }
      }
      //anonymous users
      else {
        if (!valid_email_address($txn->mail)) {
          form_set_error('mail', t('Please enter a valid email address'));
        }
      }
      break;
Eglish’s picture

Status: Reviewed & tested by the community » Fixed

whoops, forgot to change the status.

Anonymous’s picture

Status: Fixed » Closed (fixed)