[Freeipa-devel] [PATCH] add pasword change call to gui
Kevin McCarthy
kmccarth at redhat.com
Wed Sep 19 22:53:56 UTC 2007
This patch adds in the user password api call to the web gui.
Currently, I am getting a permission error for this. Making the big
assumption it's a known problem at this point.
-Kevin
-------------- next part --------------
# HG changeset patch
# User Kevin McCarthy <kmccarth at redhat.com>
# Date 1190242741 25200
# Node ID 0774967a0594d3201ab6837a746682b6b82029f4
# Parent d38d108442e06a986eec88d47aed60cdc61d477f
Add password changing call to web gui.
diff -r d38d108442e0 -r 0774967a0594 ipa-server/ipa-gui/ipagui/controllers.py
--- a/ipa-server/ipa-gui/ipagui/controllers.py Wed Sep 19 15:10:50 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/controllers.py Wed Sep 19 15:59:01 2007 -0700
@@ -151,6 +151,7 @@ class Root(controllers.RootController):
return dict(form=user_edit_form, user=kw,
tg_template='ipagui.templates.useredit')
+ password_change = False
try:
orig_user_dict = loads(b64decode(kw.get('user_orig')))
@@ -165,7 +166,7 @@ class Root(controllers.RootController):
new_user.setValue('nsAccountLock', None)
if kw.get('editprotected') == 'true':
if kw.get('userpassword'):
- new_user.setValue('userpassword', kw.get('userpassword'))
+ password_change = True
new_user.setValue('uidnumber', str(kw.get('uidnumber')))
new_user.setValue('gidnumber', str(kw.get('gidnumber')))
@@ -177,12 +178,26 @@ class Root(controllers.RootController):
new_user.getValue('sn')))
rv = client.update_user(new_user)
- turbogears.flash("%s updated!" % kw['uid'])
- raise turbogears.redirect('/usershow', uid=kw['uid'])
+ except ipaerror.exception_for(ipaerror.LDAP_EMPTY_MODLIST), e:
+ if not password_change:
+ turbogears.flash("User update failed: " + str(e))
+ return dict(form=user_edit_form, user=kw,
+ tg_template='ipagui.templates.useredit')
except ipaerror.IPAError, e:
turbogears.flash("User update failed: " + str(e))
return dict(form=user_edit_form, user=kw,
tg_template='ipagui.templates.useredit')
+
+ try:
+ if password_change:
+ rv = client.modifyPassword(kw['uid'], "", kw.get('userpassword'))
+ except ipaerror.IPAError, e:
+ turbogears.flash("User password change failed: " + str(e))
+ return dict(form=user_edit_form, user=kw,
+ tg_template='ipagui.templates.useredit')
+
+ turbogears.flash("%s updated!" % kw['uid'])
+ raise turbogears.redirect('/usershow', uid=kw['uid'])
@expose("ipagui.templates.userlist")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20070919/dbcf4f03/attachment.bin>
More information about the Freeipa-devel
mailing list