[interchange] Fix broken random password number range; consistently make random instead of using zip or phone

Jon Jensen interchange-cvs at icdevgroup.org
Sat Apr 7 03:41:55 UTC 2018


commit a1b8d8431e1dba6a1ed1b6e7fa6414fdbe6392b6
Author: Jon Jensen <jon at endpoint.com>
Date:   Fri Apr 6 21:40:08 2018 -0600

    Fix broken random password number range; consistently make random instead of using zip or phone
    
    It's gross to have this logic duplicated, but fixing that is a task for
    another day.

 dist/strap/etc/log_transaction |   44 ++++++++++++++-------------------------
 1 files changed, 16 insertions(+), 28 deletions(-)
---
diff --git a/dist/strap/etc/log_transaction b/dist/strap/etc/log_transaction
index a594db3..1f35e4c 100644
--- a/dist/strap/etc/log_transaction
+++ b/dist/strap/etc/log_transaction
@@ -253,26 +253,20 @@ Set order number in session: [calc]
 		[userdb function=logout clear=0 clear_cart=0]
 	[/if]
 	[tmp auto_create]1[/tmp]
-    [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]
+	[calcn]
+		my $pass = '';
+		my @lets = ('A'..'Z', 'a'..'z', '0'..'9');
+		$pass .= $lets[ rand @lets ]
+			while length($pass) < 8;
+		$Tag->tmpn('tmp_pass', $pass);
+		return;
+	[/calcn]
     [if type=explicit compare=|
         [userdb
             function=new_account
-                assign_username=1
-                    password='[scratch tmp_pass]'
-                        verify='[scratch tmp_pass]'
+            assign_username=1
+            password='[scratch tmp_pass]'
+            verify='[scratch tmp_pass]'
         ]
         |]
         [seti mv_autocreate]
@@ -298,17 +292,11 @@ There was an error adding you to the customer table.
 	[tmp tmp_username][data table=userdb col=usernick key="[value customer_id]"][/tmp]
 	[if !scratch tmp_username]
 		[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;
+			my $pass = '';
+			my @lets = ('A'..'Z', 'a'..'z', '0'..'9');
+			$pass .= $lets[ rand @lets ]
+				while length($pass) < 8;
+			$Tag->tmpn('tmp_pass', $pass);
 			return;
 		[/calcn]
 		[tmp hide_status][userdb



More information about the interchange-cvs mailing list