Skip to content

Commit

Permalink
Fixed gitlab request with ajax
Browse files Browse the repository at this point in the history
Signed-off-by: Macartur Sousa <[email protected]>
  • Loading branch information
macartur committed May 31, 2016
1 parent a0e12a7 commit b69ce9b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/colab_gitlab/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@ class GitlabProxyView(ColabProxyView):
('^/gitlab/users/sign_in(.*)$', r'{}\1'.format(settings.LOGIN_URL)),
)

def verify_forbidden_path(self, path, user):
def verify_forbidden_path(self, request):
path = request.path

prefix = settings.COLAB_APPS['colab_gitlab'].get('urls')
prefix = prefix.get('prefix').replace('^', '/')
forbidden = '{}profile'.format(prefix)

if forbidden in path:
if forbidden in path and not request.is_ajax():
return True
return False

def dispatch(self, request, *args, **kwargs):

self.request = request

if self.verify_forbidden_path(self.request.path, self.request.user):
if self.verify_forbidden_path(self.request):
tab = '#gitlab_profile'
path = r'/account/{}/edit'.format(self.request.user)

Expand Down

0 comments on commit b69ce9b

Please sign in to comment.