From 3c778927e28956a4362bccb080f188c7a93b0587 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sun, 30 May 2021 15:53:16 +0200 Subject: [PATCH] email settings --- cookbook/forms.py | 1 - cookbook/templates/account/email.html | 82 +++++++ cookbook/templates/account/email_confirm.html | 34 +++ cookbook/templates/settings.html | 201 +++++++++++------- cookbook/views/views.py | 10 +- 5 files changed, 248 insertions(+), 80 deletions(-) create mode 100644 cookbook/templates/account/email.html create mode 100644 cookbook/templates/account/email_confirm.html diff --git a/cookbook/forms.py b/cookbook/forms.py index e076f659..b1d9b172 100644 --- a/cookbook/forms.py +++ b/cookbook/forms.py @@ -77,7 +77,6 @@ class UserNameForm(forms.ModelForm): help_texts = { 'first_name': _('Both fields are optional. If none are given the username will be displayed instead') - # noqa: E501 } diff --git a/cookbook/templates/account/email.html b/cookbook/templates/account/email.html new file mode 100644 index 00000000..63597972 --- /dev/null +++ b/cookbook/templates/account/email.html @@ -0,0 +1,82 @@ +{% extends "base.html" %} +{% load crispy_forms_filters %} + +{% load i18n %} + +{% block title %}{% trans "E-mail Addresses" %}{% endblock %} + +{% block content %} +

{% trans "E-mail Addresses" %}

+ {% if user.emailaddress_set.all %} +

{% trans 'The following e-mail addresses are associated with your account:' %}

+ +
+ {% csrf_token %} +
+ + {% for emailaddress in user.emailaddress_set.all %} +
+ +
+ {% endfor %} + +
+ + + +
+ +
+
+ + {% else %} +

+ {% trans 'Warning:' %} {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %} +

+ + {% endif %} + + {% if can_add_email %} +

{% trans "Add E-mail Address" %}

+ +
+ {% csrf_token %} + {{ form | crispy }} + +
+ {% endif %} + +{% endblock %} + + +{% block extra_body %} + +{% endblock %} \ No newline at end of file diff --git a/cookbook/templates/account/email_confirm.html b/cookbook/templates/account/email_confirm.html new file mode 100644 index 00000000..216e62d0 --- /dev/null +++ b/cookbook/templates/account/email_confirm.html @@ -0,0 +1,34 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load account %} + +{% block title %}{% trans "Confirm E-mail Address" %}{% endblock %} + + +{% block content %} +

{% trans "Confirm E-mail Address" %}

+ + {% if confirmation %} + + {% user_display confirmation.email_address.user as user_display %} + +

{% blocktrans with confirmation.email_address.email as email %}Please confirm that + {{ email }} is an e-mail address for user {{ user_display }} + .{% endblocktrans %}

+ +
+ {% csrf_token %} + +
+ + {% else %} + + {% url 'account_email' as email_url %} + +

{% blocktrans %}This e-mail confirmation link expired or is invalid. Please + issue a new e-mail confirmation request.{% endblocktrans %}

+ + {% endif %} + +{% endblock %} \ No newline at end of file diff --git a/cookbook/templates/settings.html b/cookbook/templates/settings.html index e54ab5a3..8887d448 100644 --- a/cookbook/templates/settings.html +++ b/cookbook/templates/settings.html @@ -16,88 +16,141 @@ {% trans 'Settings' %} -
-
+ + -
- {% csrf_token %} - {{ user_name_form|crispy }} - -
- -
- {% csrf_token %} - {{ password_form|crispy }} - -
- - {% trans 'Link social account' %} -
-
- -

{% trans 'Language' %}

-
-
-
{% csrf_token %} - - -
- + +
+
+

{% trans 'Name Settings' %}

+ + {% csrf_token %} + {{ user_name_form|crispy }} + + +

{% trans 'Password Settings' %}

+
+ {% csrf_token %} + {{ password_form|crispy }} + +
+ +

{% trans 'Email Settings' %}

+ + {% trans 'Manage Email Settings' %} + +

+ +

{% trans 'Social' %}

+ + {% trans 'Manage Social Accounts' %} +
+
+
+
+
- -
- -
-
- -

{% trans 'Style' %}

- -
- {% csrf_token %} - {{ preference_form|crispy }} - -
- -
-
- -

{% trans 'API Token' %}

- {% trans 'You can use both basic authentication and token based authentication to access the REST API.' %}
-
+
+ + +
+
+

{% trans 'Language' %}

+
+
+ + +
+
+
{% csrf_token %} + + +
+ +
+
+ +
+ +
+
+

{% trans 'Style' %}

+
+
+
+
+
+ {% csrf_token %} + {{ preference_form|crispy }} + +
+
+
+ + +
+
+ +
+
+

{% trans 'API Token' %}

+ {% trans 'You can use both basic authentication and token based authentication to access the REST API.' %} +
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ {% trans 'Use the token as an Authorization header prefixed by the word token as shown in the following examples:' %} +
+ Authorization: Token {{ api_token }} {% trans 'or' %}
+ curl -X GET http://your.domain.com/api/recipes/ -H 'Authorization: + Token {{ api_token }}' +
+
-
- -
-
-
- {% trans 'Use the token as an Authorization header prefixed by the word token as shown in the following examples:' %} -
- Authorization: Token {{ api_token }} {% trans 'or' %}
- curl -X GET http://your.domain.com/api/recipes/ -H 'Authorization: Token {{ api_token }}' - -
-
-
-