0001-misc-move-account-related-texts-into-to-templates-21.patch
src/authentic2/registration_backend/views.py | ||
---|---|---|
15 | 15 |
from django.forms import CharField, Form |
16 | 16 |
from django.core.urlresolvers import reverse_lazy |
17 | 17 |
from django.http import Http404, HttpResponseBadRequest |
18 |
from django.template import loader |
|
18 | 19 | |
19 | 20 |
from authentic2.utils import (import_module_or_class, redirect, make_url, get_fields_and_labels, |
20 | 21 |
simulate_authentication) |
... | ... | |
340 | 341 |
token=request.token, service=self.service) |
341 | 342 |
simulate_authentication(request, user, method=self.authentication_method, |
342 | 343 |
service_slug=self.service) |
343 |
messages.info(self.request, _('You have just created an account.')) |
|
344 |
message_template = loader.get_template('registration/registration_success_message.html') |
|
345 |
messages.info(self.request, message_template.render(request=request)) |
|
344 | 346 |
self.send_registration_success_email(user) |
345 | 347 |
return redirect(request, self.get_success_url()) |
346 | 348 | |
... | ... | |
365 | 367 |
class DeleteView(FormView): |
366 | 368 |
template_name = 'authentic2/accounts_delete.html' |
367 | 369 |
success_url = reverse_lazy('auth_logout') |
368 |
title = _('Delete account') |
|
369 | 370 | |
370 | 371 |
def dispatch(self, request, *args, **kwargs): |
371 | 372 |
if not app_settings.A2_REGISTRATION_CAN_DELETE_ACCOUNT: |
... | ... | |
395 | 396 |
self.request.user.save(update_fields=['email', 'email_verified']) |
396 | 397 |
logger.info(u'deletion of account %s requested', self.request.user) |
397 | 398 |
hooks.call_hooks('event', name='delete-account', user=self.request.user) |
398 |
messages.info(self.request,
|
|
399 |
_('Your account has been scheduled for deletion. You cannot use it anymore.'))
|
|
399 |
message_template = loader.get_template('registration/account_deletion_message.html')
|
|
400 |
messages.info(self.request, message_template.render(request=self.request))
|
|
400 | 401 |
return super(DeleteView, self).form_valid(form) |
401 | 402 | |
402 | 403 |
registration_completion = valid_token(RegistrationCompletionView.as_view()) |
src/authentic2/templates/authentic2/accounts.html | ||
---|---|---|
2 | 2 |
{% load i18n %} |
3 | 3 | |
4 | 4 |
{% block page-title %} |
5 |
{{ block.super }} - {{ view.title }}
|
|
5 |
{{ block.super }} - {% trans "Your account" %}
|
|
6 | 6 |
{% endblock %} |
7 | 7 | |
8 | 8 |
{% block breadcrumb %} |
9 | 9 |
{{ block.super }} |
10 |
<a href="">{{ view.title }}</a>
|
|
10 |
<a href="">{% trans "Your account" %}</a>
|
|
11 | 11 |
{% endblock %} |
12 | 12 | |
13 | 13 |
{% block content %} |
src/authentic2/templates/authentic2/accounts_delete.html | ||
---|---|---|
2 | 2 |
{% load i18n %} |
3 | 3 | |
4 | 4 |
{% block page-title %} |
5 |
{{ block.super }} - {{ view.title }}
|
|
5 |
{{ block.super }} - {% trans "Delete account" %}
|
|
6 | 6 |
{% endblock %} |
7 | 7 | |
8 | 8 |
{% block breadcrumb %} |
9 | 9 |
{{ block.super }} |
10 | 10 |
<a href="{% url "account_management" %}">{% trans "Your account" %}</a> |
11 |
<a href="#">{{ view.title }}</a>
|
|
11 |
<a href="#">{% trans "Delete account" %}</a>
|
|
12 | 12 |
{% endblock %} |
13 | 13 | |
14 | 14 |
src/authentic2/templates/authentic2/accounts_edit.html | ||
---|---|---|
2 | 2 |
{% load i18n %} |
3 | 3 | |
4 | 4 |
{% block page-title %} |
5 |
{{ block.super }} - {{ view.title }}
|
|
5 |
{{ block.super }} - {% trans "Edit account data" %}
|
|
6 | 6 |
{% endblock %} |
7 | 7 | |
8 | 8 |
{% block breadcrumb %} |
9 | 9 |
{{ block.super }} |
10 | 10 |
<a href="..">{% trans "Your account" %}</a> |
11 |
<a href="">{{ view.title }}</a>
|
|
11 |
<a href="">{% trans "Edit account data" %}</a>
|
|
12 | 12 |
{% endblock %} |
13 | 13 | |
14 | 14 |
{% block content %} |
src/authentic2/templates/registration/account_deletion_message.html | ||
---|---|---|
1 |
{% load i18n %}{% trans "Your account has been scheduled for deletion. You cannot use it anymore." %} |
src/authentic2/templates/registration/registration_success_message.html | ||
---|---|---|
1 |
{% load i18n %}{% trans "You have just created an account." %} |
src/authentic2/views.py | ||
---|---|---|
65 | 65 |
model = compat.get_user_model() |
66 | 66 |
template_names = ['profiles/edit_profile.html', |
67 | 67 |
'authentic2/accounts_edit.html'] |
68 |
title = _('Edit account data') |
|
69 | 68 | |
70 | 69 |
def get_template_names(self): |
71 | 70 |
template_names = [] |
... | ... | |
394 | 393 | |
395 | 394 |
class ProfileView(cbv.TemplateNamesMixin, TemplateView): |
396 | 395 |
template_names = ['idp/account_management.html', 'authentic2/accounts.html'] |
397 |
title = _('Your account') |
|
398 | 396 | |
399 | 397 |
def dispatch(self, request, *args, **kwargs): |
400 | 398 |
if app_settings.A2_ACCOUNTS_URL: |
401 |
- |