View Single Post
  #1  
Old 08-14-2009, 05:33 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Sample/suggested password

I made this mod to suggest a password when creating a customer profile.

We tend to do this for telephone orders, set them up an account so it's there, but trying to think of passwords is a bit of a nightmare.

This adds a bit of code to automatically generate a random letter string and display it next to the password box so it can just be copy/pasted if required. Each time the page runs it creates a new string. This string is not stored anywhere, and of course there's no way to see if that password has been used before.

There's an if statement in the tpl to only display it to admins.

mods:

/admin/user_add.php
before:
Code:
# Assign the current location line $smarty->assign("location", $location);

add:
Code:
#create suggested password $v=""; for($i=0;$i<10;$i++) $v.=chr(rand(65,90)); $suggpass=$v; $smarty->assign("suggpass", $suggpass);

skin1/main/register_account.tpl
find:
Code:
<tr> <td align="right">{$lng.lbl_password}</td> <td><font class="Star">*</font></td> <td nowrap="nowrap"><input type="password" id="passwd1" name="passwd1" size="32" maxlength="64" value="{$userinfo.passwd1|escape}" /> {if $reg_error ne "" and $userinfo.passwd1 eq ""}<font class="Star">&lt;&lt;</font>{/if} </td> </tr>
change to:
Code:
<tr> <td align="right">{$lng.lbl_password}</td> <td><font class="Star">*</font></td> <td nowrap="nowrap"><input type="password" id="passwd1" name="passwd1" size="32" maxlength="64" value="{$userinfo.passwd1|escape}" /> {if $usertype eq "A"}Suggested: {$suggpass} {/if} {if $reg_error ne "" and $userinfo.passwd1 eq ""}<font class="Star">&lt;&lt;</font>{/if} </td> </tr>

I'll probably add it to the modify page as well for when we need to reset passwords.

it seems to be working on my system,
4.1.11 not sure about any others, but should be ok, and quite simple to alter.

hth
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote