diff options
Diffstat (limited to '')
-rw-r--r-- | accounts/urls.py | 1 | ||||
-rw-r--r-- | accounts/views.py | 5 | ||||
-rw-r--r-- | manager/settings.py | 8 | ||||
-rw-r--r-- | manager/urls.py | 1 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | templates/registration/base_client.html | 4 | ||||
-rw-r--r-- | version.txt | 2 |
7 files changed, 19 insertions, 3 deletions
diff --git a/accounts/urls.py b/accounts/urls.py index 57a649d..76a54e6 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -14,4 +14,5 @@ urlpatterns = [ path('oauth_disconnect/', views.oauth_disconnect, name='oauth_disconnect'), path('auth_connect/', views.auth_connect, name='auth_connect'), path('user_switcher/', views.user_switcher, name='user_switcher'), + path('logout/', views.logout_view, name='logout'), ] diff --git a/accounts/views.py b/accounts/views.py index f04f495..9ecb15f 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -789,3 +789,8 @@ def edit(request, code): def terms(request): context = {} return render(request, 'accounts/terms.html', context) + + +def logout_view(request): + logout(request) + return HttpResponseRedirect('/')
\ No newline at end of file diff --git a/manager/settings.py b/manager/settings.py index c2ffdf6..e145e45 100644 --- a/manager/settings.py +++ b/manager/settings.py @@ -66,6 +66,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'impersonate', ] MIDDLEWARE = [ @@ -76,6 +77,7 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'impersonate.middleware.ImpersonateMiddleware', ] AUTHLIB_OAUTH_CLIENTS = { @@ -174,4 +176,8 @@ STATICFILES_DIRS = [ LOGIN_REDIRECT_URL = '/' LOGOUT_REDIRECT_URL = '/' -FQD_BASE_URL = 'http://127.0.0.1:8000'
\ No newline at end of file +FQD_BASE_URL = 'http://127.0.0.1:8000' + +# Impersonate settings +REQUIRE_SUPERUSER = True +ALLOW_SUPERUSER = False
\ No newline at end of file diff --git a/manager/urls.py b/manager/urls.py index f3b8008..beaefbe 100644 --- a/manager/urls.py +++ b/manager/urls.py @@ -23,6 +23,7 @@ urlpatterns = [ path('accounts/', include('accounts.urls')), path('accounts/', include('django.contrib.auth.urls')), path('admin/', admin.site.urls), + path('impersonate/', include('impersonate.urls')), ] if settings.DEBUG: diff --git a/requirements.txt b/requirements.txt index 62c7159..05c1064 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,4 @@ pdf2image django-debug-toolbar requests authlib +django-impersonate diff --git a/templates/registration/base_client.html b/templates/registration/base_client.html index 357197a..2518988 100644 --- a/templates/registration/base_client.html +++ b/templates/registration/base_client.html @@ -134,7 +134,7 @@ <li><a class="modal-trigger" href="#modal_capi"><i class="material-icons">list</i>Lista documenti</a></li> {% endif %} - <li><a onclick="switcher_submit('logout')"><i class="material-icons">exit_to_app</i>Logout</a></li> + <li><a href="{% url 'logout' %}"><i class="material-icons">exit_to_app</i>Logout</a></li> <!-- <li class="divider" tabindex="-1"></li> <li class="divider" tabindex="-1"></li> @@ -176,12 +176,14 @@ var elems = document.querySelectorAll('.userswitcher'); var instances = M.Dropdown.init(elems, {"coverTrigger": false, "constrainWidth": false}); }); + /* function switcher_submit(id) { var form = document.getElementById('user_form') var action = document.getElementById('metadata') action.setAttribute('value', id); form.submit() } + */ {% block script %} {% endblock%} </script> diff --git a/version.txt b/version.txt index 154f90c..69dd115 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.7 -rev=14 +rev=15 |