summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-gui/ipagui/controllers.py
diff options
context:
space:
mode:
authorKevin McCarthy <kmccarth@redhat.com>2007-08-14 09:40:13 -0700
committerKevin McCarthy <kmccarth@redhat.com>2007-08-14 09:40:13 -0700
commit2ef4792fd12efc84237e005add0ed0081425d599 (patch)
treec15c5c4c6dc107ff0e5c373ea2a5cfef549bfea0 /ipa-server/ipa-gui/ipagui/controllers.py
parent10cbfe87876f536a51f3420945429cd82b7716b6 (diff)
downloadfreeipa.git-2ef4792fd12efc84237e005add0ed0081425d599.tar.gz
freeipa.git-2ef4792fd12efc84237e005add0ed0081425d599.tar.xz
freeipa.git-2ef4792fd12efc84237e005add0ed0081425d599.zip
- Add password generator method to controller.
This uses the random.SystemRandom() method to generate an 8-digit alphanumeric password. - Add ajax call to usernew and useredit forms to generate a new password - Add the prototype javascript library: http://www.prototypejs.org/ prototype is distributed with the MIT license. - Add a checkbox to toggle editing (and displaying) the password. - Change usershow template to use same field labels as the edit and new forms.
Diffstat (limited to 'ipa-server/ipa-gui/ipagui/controllers.py')
-rw-r--r--ipa-server/ipa-gui/ipagui/controllers.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/ipa-server/ipa-gui/ipagui/controllers.py b/ipa-server/ipa-gui/ipagui/controllers.py
index ec4b8719..acf1bd37 100644
--- a/ipa-server/ipa-gui/ipagui/controllers.py
+++ b/ipa-server/ipa-gui/ipagui/controllers.py
@@ -1,3 +1,4 @@
+import random
import cherrypy
import turbogears
from turbogears import controllers, expose, flash
@@ -17,6 +18,8 @@ ipa.config.init_config()
user_new_form = forms.user.UserNewForm()
user_edit_form = forms.user.UserEditForm()
+password_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+
client = ipa.ipaclient.IPAClient(True)
client.set_principal("test@FREEIPA.ORG")
@@ -137,7 +140,7 @@ class Root(controllers.RootController):
"""Retrieve a single user for display"""
try:
user = client.get_user(uid)
- return dict(user=user_to_hash(user))
+ return dict(user=user_to_hash(user), fields=forms.user.UserFields())
except xmlrpclib.Fault, f:
turbogears.flash("User show failed: " + str(f.faultString))
raise turbogears.redirect("/")
@@ -154,6 +157,16 @@ class Root(controllers.RootController):
def userindex(self):
raise turbogears.redirect("/userlist")
+ @expose()
+ def generate_password(self):
+ password = ""
+ generator = random.SystemRandom()
+ for char in range(8):
+ index = generator.randint(0, len(password_chars) - 1)
+ password += password_chars[index]
+
+ return password
+
#########
# Group #