views: define titles for self servicing views (#22407)

This commit is contained in:
Frédéric Péters 2018-03-10 08:46:29 +01:00
parent 19c3da50b7
commit 2bc22ef75d
9 changed files with 18 additions and 11 deletions

View File

@ -14,6 +14,7 @@ from . import cbv, profile_forms, utils, hooks
class PasswordResetView(cbv.NextURLViewMixin, FormView):
'''Ask for an email and send a password reset link by mail'''
form_class = profile_forms.PasswordResetForm
title = _('Password Reset')
def get_template_names(self):
return [
@ -49,6 +50,7 @@ class PasswordResetConfirmView(cbv.RedirectToNextURLViewMixin, FormView):
the user.
'''
form_class = SetPasswordForm
title = _('Password Reset')
def get_template_names(self):
return [

View File

@ -52,6 +52,7 @@ def valid_token(method):
class BaseRegistrationView(FormView):
form_class = import_module_or_class(app_settings.A2_REGISTRATION_FORM_CLASS)
template_name = 'registration/registration_form.html'
title = _('Registration')
def dispatch(self, request, *args, **kwargs):
self.token = {}
@ -349,6 +350,7 @@ class RegistrationCompletionView(CreateView):
class DeleteView(FormView):
template_name = 'authentic2/accounts_delete.html'
success_url = reverse_lazy('auth_logout')
title = _('Delete account')
def dispatch(self, request, *args, **kwargs):
if not app_settings.A2_REGISTRATION_CAN_DELETE_ACCOUNT:

View File

@ -2,12 +2,12 @@
{% load i18n %}
{% block page-title %}
{{ block.super }} - {% trans "Your account" %}
{{ block.super }} - {{ view.title }}
{% endblock %}
{% block breadcrumb %}
{{ block.super }}
<a href="">{% trans "Your account" %}</a>
<a href="">{{ view.title }}</a>
{% endblock %}
{% block content %}

View File

@ -2,13 +2,13 @@
{% load i18n %}
{% block page-title %}
{{ block.super }} - {% trans "Delete account" %}
{{ block.super }} - {{ view.title }}
{% endblock %}
{% block breadcrumb %}
{{ block.super }}
<a href="{% url "account_management" %}">{% trans "Your account" %}</a>
<a href="#">{% trans "Delete account" %}</a>
<a href="#">{{ view.title }}</a>
{% endblock %}

View File

@ -12,13 +12,13 @@
{% endblock %}
{% block page-title %}
{{ block.super }} - {% trans "Edit account data" %}
{{ block.super }} - {{ view.title }}
{% endblock %}
{% block breadcrumb %}
{{ block.super }}
<a href="..">{% trans "Your account" %}</a>
<a href="">{% trans "Edit account data" %}</a>
<a href="">{{ view.title }}</a>
{% endblock %}
{% block content %}

View File

@ -2,13 +2,13 @@
{% load i18n %}
{% block page-title %}
{{ block.super }} - {% trans "Email change" %}
{{ block.super }} - {{ view.title }}
{% endblock %}
{% block breadcrumb %}
{{ block.super }}
<a href="..">{% trans "Your account" %}</a>
<a href="">{% trans "Change email" %}</a>
<a href="">{{ view.title }}</a>
{% endblock %}
{% block content %}

View File

@ -2,7 +2,7 @@
{% load i18n %}
{% block title %}
{% trans "Resetting password" %}
{{ view.title }}
{% endblock %}
{% block content %}

View File

@ -2,7 +2,7 @@
{% load i18n %}
{% block title %}
{% trans "Registration" %}
{{ view.title }}
{% endblock %}
{% load breadcrumbs %}
@ -13,7 +13,7 @@
{% block content %}
<h2>{% trans "Registration" %}</h2>
<h2>{{ view.title }}</h2>
<form method="post">
{% csrf_token %}

View File

@ -68,6 +68,7 @@ class EditProfile(cbv.HookMixin, cbv.TemplateNamesMixin, UpdateView):
model = compat.get_user_model()
template_names = ['profiles/edit_profile.html',
'authentic2/accounts_edit.html']
title = _('Edit account data')
def get_template_names(self):
template_names = []
@ -171,6 +172,7 @@ class EmailChangeView(cbv.TemplateNamesMixin, FormView):
'profiles/email_change.html',
'authentic2/change_email.html'
]
title = _('Email Change')
success_url = '..'
def get_form_class(self):
@ -397,6 +399,7 @@ homepage = Homepage.as_view()
class ProfileView(cbv.TemplateNamesMixin, TemplateView):
template_names = ['idp/account_management.html', 'authentic2/accounts.html']
title = _('Your account')
def dispatch(self, request, *args, **kwargs):
if app_settings.A2_ACCOUNTS_URL: