Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Sample/suggested password

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #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
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:05 PM.

   

 
X-Cart forums © 2001-2020