0002-add-redirect-to-unauthorized-page-function.patch
src/authentic2/templates/authentic2/unauthorized.html | ||
---|---|---|
1 |
{% extends "authentic2/base-page.html" %} |
|
2 |
{% load i18n gadjo %} |
|
3 | ||
4 |
{% block page-title %} |
|
5 |
{{ block.super }} - {% trans "Access denied" %} |
|
6 |
{% endblock %} |
|
7 | ||
8 |
{% block content %} |
|
9 |
{% trans "You are not authorized to access this service, please contact your administrator." %} <a href="{{callback_url}}">Back</a> |
|
10 |
{% endblock %} |
src/authentic2/utils.py | ||
---|---|---|
36 | 36 |
from django.template import RequestContext |
37 | 37 |
from django.utils.http import urlsafe_base64_encode |
38 | 38 |
from django.utils.encoding import force_bytes |
39 |
from django.shortcuts import render |
|
39 | 40 | |
40 | 41 | |
41 | 42 |
try: |
... | ... | |
834 | 835 |
if seconds: |
835 | 836 |
s.append(ungettext('%s second', '%s seconds', seconds) % seconds) |
836 | 837 |
return ', '.join(s) |
838 | ||
839 | ||
840 |
def redirect_to_unauthorized(request, service): |
|
841 |
context = {'callback_url': service.unauthorized_url} |
|
842 |
return render(request, 'authentic2/unauthorized.html', context=context) |
|
837 |
- |