|
Revision 2337, 0.5 kB
(checked in by sderle, 2 years ago)
|
Add mkpasswd.cgi to website repo.
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
import os |
|---|
| 4 |
import subprocess |
|---|
| 5 |
import cgi |
|---|
| 6 |
import sys |
|---|
| 7 |
|
|---|
| 8 |
fs = cgi.FieldStorage() |
|---|
| 9 |
if (fs.has_key('passwd')): |
|---|
| 10 |
print "Content-Type: text/plain" |
|---|
| 11 |
print |
|---|
| 12 |
sys.stdout.flush() |
|---|
| 13 |
subprocess.call(['/usr/bin/htpasswd', |
|---|
| 14 |
'-nb', fs['user'].value, fs['passwd'].value]) |
|---|
| 15 |
else: |
|---|
| 16 |
print "Content-Type: text/html" |
|---|
| 17 |
print |
|---|
| 18 |
print """<form method="POST">Username: <input name="user" /><br /> |
|---|
| 19 |
Password: <input name="passwd" type="password" /><br /> |
|---|
| 20 |
<input type="submit" value="Create password" /> |
|---|
| 21 |
""" |
|---|