Skip to content

Commit

Permalink
Disable template view
Browse files Browse the repository at this point in the history
  • Loading branch information
corydickson committed Jan 8, 2021
1 parent 8629bb1 commit 3198998
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/dashboard/templates/board/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
{% endif %}
<script src="{% static "v2/js/vue-components.js" %}"></script>
<script>
document.has_ptoken_auth = {{ has_ptoken_auth|yesno:"true,false"}};
document.user_has_token = {{ ptoken|yesno:"true,false" }};
{% if ptoken %}
document.ptoken = {
Expand Down
4 changes: 2 additions & 2 deletions app/dashboard/templates/board/ptokens.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</div>
</div>
</header>

{ % if has_ptoken_auth % }
<section class="container">
<div class="row">
<div class="col-12">
Expand Down Expand Up @@ -77,12 +77,12 @@
Please try again or contact [email protected]
</button>
</template>

</div>
</div>
</div>
</div>
</section>
{ % endif % }

<section class="container">
<div class="row">
Expand Down
2 changes: 2 additions & 0 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4979,6 +4979,7 @@ def board(request):
"""Handle the board view."""

user = request.user if request.user.is_authenticated else None
has_ptoken_auth = user.has_perm('auth.user.add_pToken_auth')
keywords = user.profile.keywords
ptoken = PersonalToken.objects.filter(token_owner_profile=user.profile).first()

Expand All @@ -4991,6 +4992,7 @@ def board(request):
'avatar_url': static('v2/images/helmet.png'),
'keywords': keywords,
'ptoken': ptoken,
'has_ptoken_auth': has_ptoken_auth,
}
return TemplateResponse(request, 'board/index.html', context)

Expand Down
2 changes: 1 addition & 1 deletion app/ptokens/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def ptoken(request, token_id='me'):
{'error': _('You must be authenticated via github to use this feature!')},
status=401)

if not user.has_perm('user.add_pToken_auth'):
if not user.has_perm('auth.user.add_pToken_auth'):
return JsonResponse(
{'error': _('You are not allowed to use this feature!')},
status=403)
Expand Down

0 comments on commit 3198998

Please sign in to comment.