[Mpuls-commits] r1436 - wasko/branches/2.0/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 10 10:50:43 CET 2010


Author: torsten
Date: 2010-02-10 10:50:42 +0100 (Wed, 10 Feb 2010)
New Revision: 1436

Modified:
   wasko/branches/2.0/mpulsweb/controllers/administration.py
Log:
* mpulsweb/controllers/administration.py (AdministrationController.resetUserPassword): Copied from waskaweb.  Removed try/except block and adapted c-vars for dialogs.


Modified: wasko/branches/2.0/mpulsweb/controllers/administration.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/administration.py	2010-02-10 09:43:01 UTC (rev 1435)
+++ wasko/branches/2.0/mpulsweb/controllers/administration.py	2010-02-10 09:50:42 UTC (rev 1436)
@@ -13,6 +13,9 @@
 from mpulsweb.model.user import UserListObject, UserObject, UserGroupList, \
     UserGroup, UserGroupFactory
 
+RESET_PASSWORD_CONFIRM = _('adm_reset_user_password')
+RESET_PASSWORD_CONFIRM_QUESTION = _('adm_reset_user_password_question')
+
 NEW_USERGROUP_SUCCESS_HEADER = _('adm_new_usergroup_success_header')
 NEW_USERGROUP_SUCCESS_TEXT = _('adm_new_usergroup_success_text')
 NEW_USERGROUP_FAILURE_HEADER = _('adm_new_usergroup_failure_header')
@@ -83,6 +86,24 @@
         c.uo = UserObject(id)
         return render('/administration/edit_user.mako')
 
+    @checkRole('admin_ka')
+    def resetUserPassword(self, id=None, confirmed='0'):
+        id = self._checkInt(id)
+        confirmed = self._checkBool(confirmed)
+        c.uo = UserObject(id)
+        if confirmed:
+            c.new_password = c.uo.resetPassword()
+            return render('/administration/reset_password.mako')
+        else:
+            c.context = "../main.mako"
+            c.dialog_title = RESET_PASSWORD_CONFIRM
+            c.dialog_text = "%s %s, %s" % (RESET_PASSWORD_CONFIRM_QUESTION,
+                                        c.uo.last_name, c.uo.first_name)
+
+            c.url_yes = "/administration/resetUserPassword/%s/1" % id
+            c.url_no = "/administration/showUser/%s" % id
+            return render('/administration/dialogs/confirm_resetpassword.mako')
+
     # USERGROUPS
     @checkRole('admin_ka')
     def overviewUserGroups(self):



More information about the Mpuls-commits mailing list