[ckan-changes] commit/ckan: dread: [controller][xs]: Handle better the error with missing params when registering a user. This happens due to old form being cached, or spammers.

Bitbucket commits-noreply at bitbucket.org
Tue Jun 21 14:10:35 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/b548e5808613/
changeset:   b548e5808613
branch:      release-v1.4.1
user:        dread
date:        2011-06-21 12:11:39
summary:     [controller][xs]: Handle better the error with missing params when registering a user. This happens due to old form being cached, or spammers.
affected #:  1 file (119 bytes)

--- a/ckan/controllers/user.py	Mon Jun 20 12:14:20 2011 +0100
+++ b/ckan/controllers/user.py	Tue Jun 21 11:11:39 2011 +0100
@@ -77,10 +77,13 @@
     def register(self):
         if not self.authorizer.am_authorized(c, model.Action.USER_CREATE, model.System):
             abort(401, _('Not authorized to see this page'))
-        if request.method == 'POST': 
-            c.login = request.params.getone('login')
-            c.fullname = request.params.getone('fullname')
-            c.email = request.params.getone('email')
+        if request.method == 'POST':
+            try:
+                c.login = request.params.getone('login')
+                c.fullname = request.params.getone('fullname')
+                c.email = request.params.getone('email')
+            except KeyError, e:
+                abort(401, _('Missing parameter: %r') % e)
             if not c.login:
                 h.flash_error(_("Please enter a login name."))
                 return render("user/register.html")

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list