Added a new form to facilitate creating new user accounts in vpfa-searches

We have a Drupal 5 site we use for users to collaborate on job searches and adding users is a bit of a chore. When I was asked to add 10 users today I wasn’t looking forward to it. Redundant, monotonous and repetitive; the trifecta that is my arch-nemesis.

So I created a javascript that populates the form from an email address and creates a random password. I also added another form that just accesses the random password function.

Screen shot

Both of these prompt the user with the results so they can be emailed.

Screen shot

Here you can see the form as it’s populated:

Screen shot

Lastly I included the code to paste in the URL bar if you want to generate the url from a spreadsheet of email address.

Backend stuff

Here’s the code for the block (Permissions: Administrator only, Location: admin/user/user/create):

// <![CDATA[
function randomPassword(length){
  chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz1234567890";
  pass="";
  for(x=0;x

<form action="#"> <label for="genEmail">Email Address</label>

 This form populates the new user form. Using the email to create a username. It also generates a random password.

 </form>
<h4>Generate New Password</h4>
<form action="#"> <label for="genPass">Number of Characters</label>


This form generates a new random password.

 </form> <hr />*To execute addUser function from url use:
<code>javascript:submitGenUserForm('@uoregon.edu'); void(' ');</code>
Leave a Comment