views: fixed some view names for better usage in view whitelist access

This commit is contained in:
Marcin Kuzminski 2017-07-24 12:28:57 +02:00
parent dc2af71072
commit 49a76c81fe
6 changed files with 20 additions and 9 deletions

View file

@ -270,7 +270,7 @@ class GistView(BaseAppView):
@view_config(
route_name='gist_show_formatted_path', request_method='GET',
renderer=None)
def show(self):
def gist_show(self):
gist_id = self.request.matchdict['gist_id']
# TODO(marcink): expose those via matching dict

View file

@ -43,7 +43,7 @@ def includeme(config):
config.add_route(
name='my_account_password_update',
pattern=ADMIN_PREFIX + '/my_account/password')
pattern=ADMIN_PREFIX + '/my_account/password/update')
# my account tokens
config.add_route(

View file

@ -37,6 +37,8 @@ def route_path(name, **kwargs):
'home': '/',
'my_account_password':
ADMIN_PREFIX + '/my_account/password',
'my_account_password_update':
ADMIN_PREFIX + '/my_account/password/update',
}[name].format(**kwargs)
@ -58,7 +60,8 @@ class TestMyAccountPassword(TestController):
('__end__', 'new_password:mapping'),
('csrf_token', self.csrf_token),
]
response = self.app.post(route_path('my_account_password'), form_data).follow()
response = self.app.post(
route_path('my_account_password_update'), form_data).follow()
assert 'Successfully updated password' in response
# check_password depends on user being in session
@ -91,7 +94,8 @@ class TestMyAccountPassword(TestController):
('__end__', 'new_password:mapping'),
('csrf_token', self.csrf_token),
]
response = self.app.post(route_path('my_account_password'), form_data)
response = self.app.post(
route_path('my_account_password_update'), form_data)
assert_response = response.assert_response()
assert assert_response.get_elements('.error-block')
@ -109,7 +113,8 @@ class TestMyAccountPassword(TestController):
('__end__', 'new_password:mapping'),
('csrf_token', self.csrf_token),
]
response = self.app.post(route_path('my_account_password'), form_data)
response = self.app.post(
route_path('my_account_password_update'), form_data)
assert_session_flash(
response, 'Error occurred during update of user password')
@ -129,7 +134,8 @@ class TestMyAccountPassword(TestController):
('__end__', 'new_password:mapping'),
('csrf_token', self.csrf_token),
]
self.app.post(route_path('my_account_password'), form_data)
self.app.post(
route_path('my_account_password_update'), form_data)
response = self.app.get(route_path('home'))
session = response.get_session_from_response()

View file

@ -90,7 +90,9 @@ class MyAccountView(BaseAppView, DataGridAppView):
username=c.user.username)
form = forms.Form(
schema, buttons=(forms.buttons.save, forms.buttons.reset))
schema,
action=h.route_path('my_account_password_update'),
buttons=(forms.buttons.save, forms.buttons.reset))
c.form = form
return self._get_template_context(c)
@ -99,7 +101,7 @@ class MyAccountView(BaseAppView, DataGridAppView):
@NotAnonymous()
@CSRFRequired()
@view_config(
route_name='my_account_password', request_method='POST',
route_name='my_account_password_update', request_method='POST',
renderer='rhodecode:templates/admin/my_account/my_account.mako')
def my_account_password_update(self):
_ = self.request.translate

View file

@ -162,6 +162,9 @@ class RepoSummaryView(RepoAppView):
@view_config(
route_name='repo_summary_slash', request_method='GET',
renderer='rhodecode:templates/summary/summary.mako')
@view_config(
route_name='repo_summary_explicit', request_method='GET',
renderer='rhodecode:templates/summary/summary.mako')
def summary(self):
c = self.load_default_context()

View file

@ -39,7 +39,7 @@ class UserProfileView(BaseAppView):
@view_config(
route_name='user_profile', request_method='GET',
renderer='rhodecode:templates/users/user.mako')
def login(self):
def user_profile(self):
# register local template context
c = self._get_local_tmpl_context()
c.active = 'user_profile'