Commits

Anonymous committed 7dfc3ff Draft

Minor fixes

Comments (0)

Files changed (2)

userprofile/controllers/root.py

 # -*- coding: utf-8 -*-
 """Main Controller"""
-from pylons.controllers.util import abort
 
 from tg import TGController
 from tg import expose, flash, require, url, lurl, request, redirect, validate, config
     @expose('userprofile.templates.chpasswd')
     @require(predicates.not_anonymous())
     def chpasswd(self, **kw):
-        user = request.identity['user']
-        return dict(user=user, profile_css=get_profile_css(config),
+        return dict(profile_css=get_profile_css(config),
                     form=edit_password_form)
+
+    @require(predicates.not_anonymous())
     @expose()
     @validate(edit_password_form, error_handler=chpasswd)
     def save_password(self, password, verify_password):
         flash(_('Password successfully changed'))
         return redirect(plug_url('userprofile', '/%s' % getattr(user, primary_key(app_model.User).name)))
 
+    @require(predicates.not_anonymous())
     @expose('userprofile.templates.index')
     def me(self):
-        try:
-            user=request.identity['user']
-        except:
-            return abort(404)
+        user=request.identity['user']
         return redirect(plug_url('userprofile', '/%s' % getattr(user, primary_key(app_model.User).name)))

userprofile/templates/chpasswd.html

     <div id="userprofile_container">
         <div id="userprofile_edit_form">
             <h3>Change Password</h3>
-            ${form.display(action=h.plug_url('userprofile', '/save_password', lazy=True))}
+            ${form.display(action=h.plug_url('userprofile', '/save_password'))}
         </div>
     </div>
 </body>