Merged in feature/set-password (pull request #24)
Feature/set password Approved-by: Ramon Wenger <ramon.wenger@iterativ.ch>
This commit is contained in:
commit
c476485685
|
|
@ -2,7 +2,7 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans 'Setze dein Passwort?' %}{% endblock %}
|
||||
{% block title %}{% trans 'Setze dein Passwort' %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="logo">skillbox</h1>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans 'Du hast es geschafft' %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="logo">skillbox</h1>
|
||||
<h2 class="reset-heading">{% trans 'Du hast es geschafft' %}</h2>
|
||||
<p>{% trans 'Dein Passwort wurde erfolgreich gespeichert. Du kannst dich nun anmelden.' %}</p>
|
||||
<p><a href="{% url "login" %}">{% trans 'Jetzt anmelden' %}</a></p>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!-- templates/registration/password_reset_confirm.html -->
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans 'Setze dein Passwort' %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="logo">skillbox</h1>
|
||||
<h2 class="reset-heading">{% trans 'Gib ein persönliche Passwort ein:' %}</h2>
|
||||
|
||||
<form method="post" class="mt-1">
|
||||
{% csrf_token %}
|
||||
<div>
|
||||
{{ form.new_password1.label_tag }}
|
||||
{{ form.new_password1 }}
|
||||
</div>
|
||||
<div>
|
||||
{{ form.new_password2.label_tag }}
|
||||
{{ form.new_password2 }}
|
||||
</div>
|
||||
<button class="btn mt-1" type="submit" name="action">{% trans 'Passwort speichern' %}</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!-- templates/registration/password_reset_form.html -->
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans 'Schau in dein Postfach' %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="logo">skillbox</h1>
|
||||
<h2 class="reset-heading">{% trans 'Schau in dein Postfach' %}</h2>
|
||||
<p>{% trans 'Wir haben ein E-Mail mit allen weiteren Anweisungen an dich verschickt. Das E-Mail sollte in Kürze bei dir ankommen.' %}</p>
|
||||
<p>{% trans 'Hinweis: Deine persönlichen Angaben für dein Benutzerkonto wurden zuvor in Myskillbox importiert. Du kannst ausschliesslich die importierte E-Mail verwenden. Wenn du nicht weisst, welche E-Mail für dich importiert wurde, kannst du deine Lehrperson fragen.' %}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{% load i18n %}{% autoescape off %}
|
||||
{% blocktrans %}Du erhältst dieses E-Mail, um dein Passwort auf {{ site_name }} initial zu setzen.{% endblocktrans %}
|
||||
|
||||
{% trans "Bitte öffne folgende Seite, um dein neues Passwort einzugeben:" %}
|
||||
{% block reset_link %}
|
||||
{{ protocol }}://{{ domain }}{% url 'set_password_confirm' uidb64=uid token=token %}
|
||||
{% endblock %}
|
||||
{% trans "Dein Benutzername lautet:" %} {{ user.get_username }}
|
||||
|
||||
{% trans "Dein Skillbox Team" %}
|
||||
|
||||
{% endautoescape %}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- templates/registration/password_reset_form.html -->
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans 'Willkommen bei Myskillbox' %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="logo">skillbox</h1>
|
||||
<h2 class="reset-heading">{% trans 'Willkommen bei Myskillbox' %}</h2>
|
||||
<p>{% trans 'Bevor du Myskillbox verwenden kannst, muss du deine E-Mail bestätigen und ein persönliches Passwort festlegen.' %}</p>
|
||||
|
||||
<form method="post" class="mt-1">
|
||||
{% csrf_token %}
|
||||
|
||||
<div>
|
||||
<label for="id_email">{% trans 'Gib als erstes hier dein E-Mail ein:' %}</label>
|
||||
{{ form.email }}
|
||||
</div>
|
||||
<button class="btn mt-1" type="submit" name="action">{% trans 'E-Mail bestätigen' %}</button>
|
||||
<input type="hidden" name="next" value="{{ next }}"/>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1 @@
|
|||
Myskillbox: E-Mail bestätigen und Passwort setzen
|
||||
|
|
@ -2,12 +2,13 @@ from django.conf import settings
|
|||
from django.conf.urls import url, include
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.urls import re_path
|
||||
from django.urls import re_path, path
|
||||
from django.views.generic import RedirectView
|
||||
from wagtail.admin import urls as wagtailadmin_urls
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
|
||||
from core import views
|
||||
from core.views import SetPasswordView, SetPasswordDoneView, SetPasswordConfirmView, SetPasswordCompleteView
|
||||
|
||||
urlpatterns = [
|
||||
# django admin
|
||||
|
|
@ -15,6 +16,12 @@ urlpatterns = [
|
|||
url(r'^accounts/', include('django.contrib.auth.urls')),
|
||||
url(r'^statistics/', include('statistics.urls', namespace='statistics')),
|
||||
|
||||
# set password
|
||||
path('welcome/', SetPasswordView.as_view(), name='set_password'),
|
||||
path('set-password/done/', SetPasswordDoneView.as_view(), name='set_password_done'),
|
||||
path('set-password/<uidb64>/<token>/', SetPasswordConfirmView.as_view(), name='set_password_confirm'),
|
||||
path('set-password/done/', SetPasswordCompleteView.as_view(), name='set_password_complete'),
|
||||
|
||||
# wagtail
|
||||
url(r'^cms/', include(wagtailadmin_urls)),
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@ import requests
|
|||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.contrib.auth.views import PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, \
|
||||
PasswordResetCompleteView
|
||||
from django.http.response import HttpResponse
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from graphene_django.views import GraphQLView
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class PrivateGraphQLView(LoginRequiredMixin, GraphQLView):
|
||||
|
|
@ -22,3 +26,27 @@ def home(request):
|
|||
print('Can not connect to dev server at http://localhost:8080:', e)
|
||||
|
||||
return render(request, 'index.html', {})
|
||||
|
||||
|
||||
class SetPasswordView(PasswordResetView):
|
||||
email_template_name = 'registration/set_password_email.html'
|
||||
subject_template_name = 'registration/set_password_subject.txt'
|
||||
success_url = reverse_lazy('set_password_done')
|
||||
template_name = 'registration/set_password_form.html'
|
||||
title = _('Password setzen')
|
||||
|
||||
|
||||
class SetPasswordDoneView(PasswordResetDoneView):
|
||||
template_name = 'registration/set_password_done.html'
|
||||
title = _('Password setzen versandt')
|
||||
|
||||
|
||||
class SetPasswordConfirmView(PasswordResetConfirmView):
|
||||
success_url = reverse_lazy('set_password_complete')
|
||||
template_name = 'registration/set_password_confirm.html'
|
||||
title = _('Gib ein Passwort ein')
|
||||
|
||||
|
||||
class SetPasswordCompleteView(PasswordResetCompleteView):
|
||||
template_name = 'registration/set_password_complete.html'
|
||||
title = _('Passwort setzen erfolgreich')
|
||||
|
|
|
|||
Loading…
Reference in New Issue