Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replace bad passwords 1

Status
Not open for further replies.

Aeros

Programmer
Oct 7, 2002
166
0
0
US
Im trying to figure out the best way to loop through my list of users that have set their password to 'password' and replace it with random characters.

SELECT nvcPassword
FROM test
WHERE nvcPassword = 'password'

The way I tried it was:

<cfloop index="i" from="1" to="16">
<CFQUERY DATASOURCE="411_users">
UPDATE test
SET nvcPassword='#RandRange(11111, 99999)#'
WHERE nvcPassword='password'
</CFQUERY>
</cfloop>

But its all the same number.
Thanks
 
In SQL Server I recently had to set temporary passwords for users imported for an email campaign. I used the NewID() function in SQL Server, which generates a UUID. I took the first eight characters of the generated UUID (the ninth is a hyphen) and used those as temporary passwords.

Update Users
SET UserPass =
CASE UserPass
WHEN 'password' THEN LEFT(NEWID(),8)
ELSE UserPass
END

-Tek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top