X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Sample/suggested password (https://forum.x-cart.com/showthread.php?t=49175)

amy2203 08-14-2009 05:33 AM

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


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

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.