Code

Changes between Version 6 and Version 7 of AdminApplication


Ignore:
Timestamp:
08/20/08 05:56:00 (6 years ago)
Author:
anonymous
Comment:

Restored previous version.

Legend:

Unmodified
Added
Removed
Modified
  • AdminApplication

    v6 v7  
     1= The Admin Application - Common pitfalls = 
     2 
     3== Creating new users == 
     4 
     5=== Passwords === 
     6 
     7*Note: This is no longer a problem in the Django development version, as of [3520].* 
     8 
     9One FAQ about the admin app is how to create new users. In particular how to set the password. It has been decided (and mooted on the lists) that the password field will only accept password hashes rather than plain text password. The problem is how one goes about generating these hashes. The following script will generate passwords on the command line. Run it with: {{{python <scriptname> <password>}}} and you'll get the correct output to paste into the admin app. IMPORTANT SECURITY NOTE: The password will turn up as plain text in your shell history, so take appropriate measures: change permissions, get an administrator you can trust or tweak the script not to use the command line.  
     10 
     11{{{ 
     12import sha, random, sys 
     13try: 
     14    raw_password = sys.argv[1] 
     15except IndexError: 
     16    print "Oh your Designer. You only had to type one thing in. How easy do I have to make it for you?" 
     17    sys.exit() 
     18algo = 'sha1' 
     19salt = sha.new(str(random.random())).hexdigest()[:5] 
     20hsh = sha.new(salt+raw_password).hexdigest() 
     21print "%s$%s$%s" % (algo, salt, hsh) 
     22}}}