Changeset - 86ee450f8b2d
[Not reviewed]
default
0 3 0
Mads Kiilerich - 9 years ago 2016-08-04 14:23:36
madski@unity3d.com
routing: introduce 'my_account_api_keys_delete' url and use POST instead of DELETE
3 files changed with 8 insertions and 8 deletions:
0 comments (0 inline, 0 general)
kallithea/config/routing.py
Show inline comments
 
@@ -364,8 +364,8 @@ def make_map(config):
 
                  action="my_account_api_keys", conditions=dict(method=["GET"]))
 
        m.connect("my_account_api_keys", "/my_account/api_keys",
 
                  action="my_account_api_keys_add", conditions=dict(method=["POST"]))
 
        m.connect("my_account_api_keys", "/my_account/api_keys",
 
                  action="my_account_api_keys_delete", conditions=dict(method=["DELETE"]))
 
        m.connect("my_account_api_keys_delete", "/my_account/api_keys/delete",
 
                  action="my_account_api_keys_delete", conditions=dict(method=["POST"]))
 

	
 
    #NOTIFICATION REST ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
kallithea/templates/admin/my_account/my_account_api_keys.html
Show inline comments
 
@@ -7,7 +7,7 @@
 
        </td>
 
        <td>${_('Expires')}: ${_('Never')}</td>
 
        <td>
 
            ${h.form(url('my_account_api_keys'),method='delete')}
 
            ${h.form(url('my_account_api_keys_delete'))}
 
                ${h.hidden('del_api_key',c.user.api_key)}
 
                ${h.hidden('del_api_key_builtin',1)}
 
                <button class="btn btn-mini btn-danger" type="submit"
 
@@ -34,7 +34,7 @@
 
                 %endif
 
            </td>
 
            <td>
 
                ${h.form(url('my_account_api_keys'),method='delete')}
 
                ${h.form(url('my_account_api_keys_delete'))}
 
                    ${h.hidden('del_api_key',api_key.api_key)}
 
                    <button class="btn btn-mini btn-danger" type="submit"
 
                            onclick="return confirm('${_('Confirm to remove this API key: %s') % api_key.api_key}');">
kallithea/tests/functional/test_my_account.py
Show inline comments
 
@@ -225,8 +225,8 @@ class TestMyAccountController(TestContro
 
        keys = UserApiKeys.query().all()
 
        assert 1 == len(keys)
 

	
 
        response = self.app.post(url('my_account_api_keys'),
 
                 {'_method': 'delete', 'del_api_key': keys[0].api_key, '_authentication_token': self.authentication_token()})
 
        response = self.app.post(url('my_account_api_keys_delete'),
 
                 {'del_api_key': keys[0].api_key, '_authentication_token': self.authentication_token()})
 
        self.checkSessionFlash(response, 'API key successfully deleted')
 
        keys = UserApiKeys.query().all()
 
        assert 0 == len(keys)
 
@@ -240,8 +240,8 @@ class TestMyAccountController(TestContro
 
        response.mustcontain(api_key)
 
        response.mustcontain('Expires: Never')
 

	
 
        response = self.app.post(url('my_account_api_keys'),
 
                 {'_method': 'delete', 'del_api_key_builtin': api_key, '_authentication_token': self.authentication_token()})
 
        response = self.app.post(url('my_account_api_keys_delete'),
 
                 {'del_api_key_builtin': api_key, '_authentication_token': self.authentication_token()})
 
        self.checkSessionFlash(response, 'API key successfully reset')
 
        response = response.follow()
 
        response.mustcontain(no=[api_key])
0 comments (0 inline, 0 general)