Changeset - d5b837c8b451
[Not reviewed]
default
0 3 0
Mads Kiilerich - 9 years ago 2016-09-25 17:21:07
madski@unity3d.com
users: use the form URL for POST so the htmlfill error page URL will be the same as the initial form URL.

This also reveals that a test used a GET route for POST - they just happened to
be the same.

These problems can probably be found in many places - there should be a general
cleanup.
3 files changed with 12 insertions and 11 deletions:
0 comments (0 inline, 0 general)
kallithea/config/routing.py
Show inline comments
 
@@ -170,7 +170,7 @@ def make_map(config):
 
    #ADMIN USER ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/users') as m:
 
        m.connect("users", "/users",
 
        m.connect("new_user", "/users/new",
 
                  action="create", conditions=dict(method=["POST"]))
 
        m.connect("users", "/users",
 
                  action="index", conditions=dict(method=["GET"]))
kallithea/templates/admin/users/user_add.html
Show inline comments
 
@@ -23,7 +23,7 @@
 
        ${self.breadcrumbs()}
 
    </div>
 
    <!-- end box / title -->
 
    ${h.form(url('users'))}
 
    ${h.form(url('new_user'))}
 
    <div class="form">
 
        <!-- fields -->
 
        <div class="fields">
kallithea/tests/functional/test_admin_users.py
Show inline comments
 
@@ -54,7 +54,7 @@ class TestAdminUsersController(TestContr
 
    def test_index(self):
 
        self.log_user()
 
        response = self.app.get(url('users'))
 
        # Test response...
 
        # TODO: Test response...
 

	
 
    def test_create(self):
 
        self.log_user()
 
@@ -65,7 +65,7 @@ class TestAdminUsersController(TestContr
 
        lastname = u'lastname'
 
        email = 'mail@example.com'
 

	
 
        response = self.app.post(url('users'),
 
        response = self.app.post(url('new_user'),
 
            {'username': username,
 
             'password': password,
 
             'password_confirmation': password_confirmation,
 
@@ -101,13 +101,14 @@ class TestAdminUsersController(TestContr
 
        lastname = u'lastname'
 
        email = 'errmail.example.com'
 

	
 
        response = self.app.post(url('users'), {'username': username,
 
                                               'password': password,
 
                                               'name': name,
 
                                               'active': False,
 
                                               'lastname': lastname,
 
                                               'email': email,
 
                                               '_authentication_token': self.authentication_token()})
 
        response = self.app.post(url('new_user'),
 
            {'username': username,
 
             'password': password,
 
             'name': name,
 
             'active': False,
 
             'lastname': lastname,
 
             'email': email,
 
             '_authentication_token': self.authentication_token()})
 

	
 
        msg = validators.ValidUsername(False, {})._messages['system_invalid_username']
 
        msg = h.html_escape(msg % {'username': 'new_user'})
0 comments (0 inline, 0 general)