forked from beba/foerderbarometer
implemented the logic for having a landingpage with a button poining to oauth login for extern view, while leaving /admin with passwort login
This commit is contained in:
parent
a51552d4dd
commit
a5834ee8c9
|
@ -163,7 +163,7 @@ DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||||
|
|
||||||
|
|
||||||
# OAuth Settings
|
# OAuth Settings
|
||||||
OAUTH_URL_WHITELISTS = ['/admin']
|
OAUTH_URL_WHITELISTS = ['/admin', '/index']
|
||||||
|
|
||||||
OAUTH_CLIENT_NAME = '<name-of-the-configured-wikimedia-app>'
|
OAUTH_CLIENT_NAME = '<name-of-the-configured-wikimedia-app>'
|
||||||
OAUTH_CLIENT_NAME = get_secret('OAUTH_CLIENT_NAME')
|
OAUTH_CLIENT_NAME = get_secret('OAUTH_CLIENT_NAME')
|
||||||
|
|
|
@ -14,6 +14,9 @@ class OAuthMiddleware(MiddlewareMixin):
|
||||||
self.oauth = OAuth()
|
self.oauth = OAuth()
|
||||||
|
|
||||||
def process_request(self, request):
|
def process_request(self, request):
|
||||||
|
# added this if clause to get the landing page before oauth
|
||||||
|
if request.path == '/':
|
||||||
|
return self.get_response(request)
|
||||||
if settings.OAUTH_URL_WHITELISTS is not None:
|
if settings.OAUTH_URL_WHITELISTS is not None:
|
||||||
for w in settings.OAUTH_URL_WHITELISTS:
|
for w in settings.OAUTH_URL_WHITELISTS:
|
||||||
if request.path.startswith(w):
|
if request.path.startswith(w):
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="/admin/jsi18n/"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'admin/js/core.js' %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'admin/js/vendor/jquery/jquery.js' %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}"></script>
|
||||||
|
|
||||||
|
{{ form.media }}
|
||||||
|
|
||||||
|
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/base.css' %}" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/widgets.css' %}" />
|
||||||
|
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% csrf_token %}
|
||||||
|
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<style>
|
||||||
|
ul > li {
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
padding-left: 10;
|
||||||
|
}
|
||||||
|
label.required::after {
|
||||||
|
content: ' *';
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img src="https://upload.wikimedia.org/wikipedia/commons/c/c4/Figuren_klein.jpg"><p>
|
||||||
|
Eine Übersicht aller Förderangebote von Wikimedia Deutschland findest du im <a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Förderangebote">
|
||||||
|
Förderportal in der deutschsprachigen Wikipedia</a>.
|
||||||
|
<br>Für alle Fragen wende dich gern an das <a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Wikimedia_Deutschland">Team Communitys und Engagement</a>.
|
||||||
|
<p>
|
||||||
|
Für interessierte Hacker gibts auch den <a href="https://srcsrv.wikimedia.de/beba/foerderbarometer">Sourcecode</a> zum Formular und was damit passiert.
|
||||||
|
<p>
|
||||||
|
<a href="https://www.wikimedia.de/impressum/">Impressum</a>
|
||||||
|
<p>
|
||||||
|
<a href="http://localhost:8000/extern">OAUTH</a>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import ExternView, done, authorize, deny, InternView, export
|
from .views import ExternView, index, done, authorize, deny, InternView, export
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', ExternView.as_view(), name='extern'),
|
path('', index, name='index'),
|
||||||
|
path('extern', ExternView.as_view(), name='extern'),
|
||||||
# path('intern', InternView.as_view(), name='intern'),
|
# path('intern', InternView.as_view(), name='intern'),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('saved', done, name='done'),
|
path('saved', done, name='done'),
|
||||||
|
|
|
@ -70,6 +70,8 @@ def deny(request, choice, pk):
|
||||||
def done(request):
|
def done(request):
|
||||||
return HttpResponse("Deine Anfrage wurde gesendet. Du erhältst in Kürze eine E-Mail-Benachrichtigung mit deinen Angaben. Für alle Fragen kontaktiere bitte das Team Communitys und Engagement unter community@wikimedia.de.")
|
return HttpResponse("Deine Anfrage wurde gesendet. Du erhältst in Kürze eine E-Mail-Benachrichtigung mit deinen Angaben. Für alle Fragen kontaktiere bitte das Team Communitys und Engagement unter community@wikimedia.de.")
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
return render(request, 'input/index.html')
|
||||||
|
|
||||||
class InternView(LoginRequiredMixin, CookieWizardView):
|
class InternView(LoginRequiredMixin, CookieWizardView):
|
||||||
'''This View is for WMDE-employees only'''
|
'''This View is for WMDE-employees only'''
|
||||||
|
|
Loading…
Reference in New Issue