Page 1 of 1

[EASY MOD] Friendly Temp-Password Generator

Posted: Mon Sep 27, 2010 8:16 pm
by CharlieFoxtrot
I had little else to do today... so I decided to update the function that generates temporary passwords.

It's been my experience that many (most?) people who request a temporary password are often the customers the need a little bit of hand-holding... and who are the ones who are most likely to appreciate anything we can do to make their online shopping experience as SIMPLE as possible.

The following edit makes the temporary passwords a bit friendlier, easier to remember, and easier to type. (Believe it or not, some of my older customers still have difficulty with "cut-and-paste".)

TESTED IN: ISC version 4.07 (Perhaps this function still exists in newer versions)
REGULAR WARNINGS: At your own risk... test before going live... keep backups... yadda-yadda-yadda!

FILE TO EDIT: /lib/general.php

SEARCH FOR:

Code: Select all

function GenerateReadablePassword($charLength=GENERATED_PASSWORD_LENGTH)
CHANGE TO:

Code: Select all

function OLD_GenerateReadablePassword($charLength=GENERATED_PASSWORD_LENGTH)
JUST ABOVE THAT, ADD THIS:

Code: Select all

function GenerateReadablePassword() {
	$adjectives = "red,white,blue,green,orange,yellow,pink,purple,violet,happy,silly";
	$nouns =  "pony,kitten,puppy,house,mouse,horse,cat,dog,duck,fish,pizza,monkey,zebra,";
	$nouns .= "elephant,chicken,sheep,rhino,tree,flower,flamingo,robin,sparrow,lion,tiger,";
	$nouns .= "bear,fox,deer,cow,piglet,turkey,donkey,goat,eagle,swan,owl,penguin,whale,dolphin";
	$nouns = explode(',', $nouns);
	$adjectives = explode(',', $adjectives);
	mt_srand((double)microtime()*1000000);
	$a = mt_rand(0, count($adjectives)-1);
	$n = mt_rand(0, count($nouns)-1);
	$pwd =  $adjectives[$a] . $nouns[$n];
	return $pwd;
}
Add or delete adjectives and nouns as you see fit.

I realize that the passwords generated here are easier to guess (if someone is so inclined)... but I'm satisfied that the initial email confirmation (BEFORE a password is provided) is sufficient for my purposes.

Re: [EASY MOD] Friendly Temp-Password Generator

Posted: Mon Sep 27, 2010 9:16 pm
by Tony Barnes
Nice little idea, I've lost count of how many people's password I've reset to "password" to try and save keyboard vs head problems...

Re: [EASY MOD] Friendly Temp-Password Generator

Posted: Thu Apr 28, 2011 8:56 am
by myshop
Works in 5.5.4, but not in 6.1.1 - that function is gone from the general.php file in 6.1.1.

Re: [EASY MOD] Friendly Temp-Password Generator

Posted: Thu Apr 28, 2011 10:51 am
by Martin
myshop wrote:Works in 5.5.4, but not in 6.1.1 - that function is gone from the general.php file in 6.1.1.
New location is:
/lib/Interspire/String.php


There's also this mod, which is related but a different approach:
viewtopic.php?f=12&t=231&p=860&hilit=password#p860