[EASY MOD] Friendly Temp-Password Generator

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
Post Reply
CharlieFoxtrot
Confirmed
Confirmed
Posts: 413
Joined: Sun Aug 09, 2009 1:23 pm

[EASY MOD] Friendly Temp-Password Generator

Post 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.
ISC 4.0.7

"... and let's be honest that whole "by design" thing is getting old too."
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: [EASY MOD] Friendly Temp-Password Generator

Post 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...
myshop
Posts: 51
Joined: Tue Jun 23, 2009 5:48 am
Location: NSW Australia
Contact:

Re: [EASY MOD] Friendly Temp-Password Generator

Post 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.
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [EASY MOD] Friendly Temp-Password Generator

Post 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
Post Reply