From 7a238b464b153673b2233dafcb4e914e1ba5d1f8 Mon Sep 17 00:00:00 2001 From: Mike Heins Date: Fri, 4 Aug 2006 14:57:22 +0000 Subject: [PATCH] * Prevent user creation problems when password from zip is not long enough. --- dist/standard/etc/log_transaction | 50 ++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/dist/standard/etc/log_transaction b/dist/standard/etc/log_transaction index fa6940af1..0d3131a63 100644 --- a/dist/standard/etc/log_transaction +++ b/dist/standard/etc/log_transaction @@ -250,24 +250,38 @@ Set order number in session: [calc] [userdb function=logout clear=0 clear_cart=0] [/if] [tmp auto_create]1[/tmp] - [if type=explicit compare=| - [userdb - function=new_account - assign_username=1 - password='[value zip]' - verify='[value zip]' - ] - |] - [seti mv_autocreate] - mv_username=[data session username] - mv_password=[value zip] - [/seti] - Auto-created user [seti auto_username][data session username][/seti][scratch auto_username]. - [else] - Auto-create of user failed. Reason: [data session failure] - [perl] die errmsg("Auto-create of user failed. Reason: %s", $Session->{failure}) [/perl] - [/else] - [/if] + [calcn] + $Tag->tmp('tmp_pass'); + for(qw/ zip phone_day phone_night /) { + my $pass = $Values->{$_}; + $pass =~ s/\s+//g; + next if length($pass) < 4; + $Scratch->{tmp_pass} = $pass; + } + + my @lets = ('A' .. 'Z', '0 .. 9', 'a' .. 'z'); + $Scratch->{tmp_pass} .= $lets[ rand @lets ] + while length($Scratch->{tmp_pass}) < 5; + return; + [/calcn] + [if type=explicit compare=| + [userdb + function=new_account + assign_username=1 + password='[scratch tmp_pass]' + verify='[scratch tmp_pass]' + ] + |] + [seti mv_autocreate] + mv_username=[data session username] + mv_password=[scratch tmp_pass] + [/seti] + Auto-created user [seti auto_username][data session username][/seti][scratch auto_username]. + [else] + Auto-create of user failed. + [perl] die errmsg("Auto-create of user failed."); [/perl] + [/else] + [/if] [/try] [catch error-set="Customer record creation" error-scratch="mv_route_failed"] There was an error adding you to the customer table.