Password reset, standardize some stuff.
authorRadek Czajka <rczajka@rczajka.pl>
Fri, 29 Mar 2019 13:25:08 +0000 (14:25 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Fri, 29 Mar 2019 13:25:08 +0000 (14:25 +0100)
26 files changed:
.gitignore
src/accounts/forms.py
src/accounts/locale/pl/LC_MESSAGES/django.mo [new file with mode: 0644]
src/accounts/locale/pl/LC_MESSAGES/django.po [new file with mode: 0644]
src/accounts/locale/pl_PL/LC_MESSAGES/django.mo [deleted file]
src/accounts/locale/pl_PL/LC_MESSAGES/django.po [deleted file]
src/accounts/migrations/0002_servicegroup_serviceuser.py [new file with mode: 0644]
src/accounts/models.py
src/accounts/templates/account/base.html [new file with mode: 0644]
src/accounts/templates/account/profile.html
src/accounts/templates/registration/password_change_done.html [new file with mode: 0644]
src/accounts/templates/registration/password_change_form.html [new file with mode: 0644]
src/accounts/templates/registration/password_reset_complete.html [new file with mode: 0644]
src/accounts/templates/registration/password_reset_confirm.html [new file with mode: 0644]
src/accounts/templates/registration/password_reset_done.html [new file with mode: 0644]
src/accounts/templates/registration/password_reset_email.html [new file with mode: 0644]
src/accounts/templates/registration/password_reset_form.html [new file with mode: 0644]
src/accounts/urls.py
src/accounts/views.py
src/cas/locale/pl/LC_MESSAGES/django.mo
src/cas/locale/pl/LC_MESSAGES/django.po
src/cas/settings.py
src/cas/static/css/main.css
src/cas/templates/base.html
src/cas/templates/cas/login.html
src/cas/urls.py

index 999c6ae..e3690f6 100755 (executable)
@@ -3,4 +3,5 @@
 localsettings.py
 /media
 /static
+*~
 
index 5dcb842..0c8cb66 100644 (file)
@@ -1,26 +1,10 @@
 from django import forms
-from django.contrib.auth.models import User as DjangoUser
-from django.utils.translation import ugettext_lazy as _
+from django.contrib.auth.models import User
+
 
 class UserBasicForm(forms.ModelForm):
 
     class Meta:
-        model = DjangoUser
+        model = User
         fields = ('first_name', 'last_name', 'email',)
 
-
-class UserPasswordForm(forms.Form):
-
-    new_password = forms.CharField(widget=forms.PasswordInput(),
-                        label=_("Your new password"))
-    verifier = forms.CharField(widget=forms.PasswordInput(),
-                        label=_("Repeated password"))
-
-    def clean(self):
-        if 'verifier' not in self.cleaned_data or 'new_password' not in self.cleaned_data:
-            return self.cleaned_data
-
-        if self.cleaned_data['verifier'] != self.cleaned_data['new_password']:
-            raise forms.ValidationError(_("Passwords do not match!"))
-
-        return self.cleaned_data
diff --git a/src/accounts/locale/pl/LC_MESSAGES/django.mo b/src/accounts/locale/pl/LC_MESSAGES/django.mo
new file mode 100644 (file)
index 0000000..99a7b83
Binary files /dev/null and b/src/accounts/locale/pl/LC_MESSAGES/django.mo differ
diff --git a/src/accounts/locale/pl/LC_MESSAGES/django.po b/src/accounts/locale/pl/LC_MESSAGES/django.po
new file mode 100644 (file)
index 0000000..cd0ec48
--- /dev/null
@@ -0,0 +1,132 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2019-03-29 14:19+0100\n"
+"PO-Revision-Date: 2019-03-29 14:15+0100\n"
+"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
+"Language-Team: \n"
+"Language: pl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 2.0.6\n"
+
+#: templates/account/base.html:8
+msgid "Change at Gravatar.com"
+msgstr "Zmień na Gravatar.com"
+
+#: templates/account/base.html:10 templates/account/profile.html:5
+#: templates/account/profile.html:16
+msgid "Your profile"
+msgstr "Twój profil"
+
+#: templates/account/base.html:11
+#: templates/registration/password_change_done.html:14
+msgid "Password change"
+msgstr ""
+
+#: templates/account/base.html:12
+msgid "E-mail"
+msgstr "E-mail"
+
+#: templates/account/base.html:13
+msgid "SSH keys"
+msgstr "Klucze SSH"
+
+#: templates/account/base.html:15
+msgid "Logout"
+msgstr "Wyloguj"
+
+#: templates/account/profile.html:20
+msgid "Change profile"
+msgstr "Zmień profil"
+
+#: templates/registration/password_change_done.html:15
+msgid "Your password was changed."
+msgstr ""
+
+#: templates/registration/password_change_form.html:22
+msgid "Please correct the error below."
+msgstr ""
+
+#: templates/registration/password_change_form.html:24
+msgid "Please correct the errors below."
+msgstr ""
+
+#: templates/registration/password_change_form.html:29
+msgid ""
+"Please enter your old password, for security's sake, and then enter your new "
+"password twice so we can verify you typed it in correctly."
+msgstr ""
+
+#: templates/registration/password_change_form.html:34
+#: templates/registration/password_reset_confirm.html:20
+msgid "Change my password"
+msgstr ""
+
+#: templates/registration/password_reset_complete.html:13
+msgid "Your password has been set.  You may go ahead and log in now."
+msgstr ""
+
+#: templates/registration/password_reset_complete.html:15
+msgid "Log in"
+msgstr ""
+
+#: templates/registration/password_reset_confirm.html:15
+msgid ""
+"Please enter your new password twice so we can verify you typed it in "
+"correctly."
+msgstr ""
+
+#: templates/registration/password_reset_confirm.html:24
+msgid ""
+"The password reset link was invalid, possibly because it has already been "
+"used.  Please request a new password reset."
+msgstr ""
+
+#: templates/registration/password_reset_done.html:14
+msgid ""
+"We've emailed you instructions for setting your password, if an account "
+"exists with the email you entered. You should receive them shortly."
+msgstr ""
+
+#: templates/registration/password_reset_done.html:16
+msgid ""
+"If you don't receive an email, please make sure you've entered the address "
+"you registered with, and check your spam folder."
+msgstr ""
+
+#: templates/registration/password_reset_email.html:2
+#, python-format
+msgid ""
+"You're receiving this email because you requested a password reset for your "
+"user account at %(site_name)s."
+msgstr ""
+
+#: templates/registration/password_reset_email.html:4
+msgid "Please go to the following page and choose a new password:"
+msgstr ""
+
+#: templates/registration/password_reset_email.html:8
+msgid "Your username, in case you've forgotten:"
+msgstr ""
+
+#: templates/registration/password_reset_form.html:12
+msgid ""
+"Forgotten your password? Enter your email address below, and we'll email "
+"instructions for setting a new one."
+msgstr ""
+
+#: templates/registration/password_reset_form.html:16
+msgid "Reset my password"
+msgstr ""
+
+#: views.py:18
+msgid "Profile has been changed."
+msgstr "Profil został zmieniony."
diff --git a/src/accounts/locale/pl_PL/LC_MESSAGES/django.mo b/src/accounts/locale/pl_PL/LC_MESSAGES/django.mo
deleted file mode 100644 (file)
index 63b2a7d..0000000
Binary files a/src/accounts/locale/pl_PL/LC_MESSAGES/django.mo and /dev/null differ
diff --git a/src/accounts/locale/pl_PL/LC_MESSAGES/django.po b/src/accounts/locale/pl_PL/LC_MESSAGES/django.po
deleted file mode 100644 (file)
index dbd98d8..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-04-15 11:11+0200\n"
-"PO-Revision-Date: 2013-04-15 11:11+0100\n"
-"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#: forms.py:15
-msgid "Your new password"
-msgstr "Twoje nowe hasło"
-
-#: forms.py:17
-msgid "Repeated password"
-msgstr "Powtórzone hasło"
-
-#: forms.py:24
-msgid "Passwords do not match!"
-msgstr "Hasło i powtórzenie się nie zgadzają!"
-
-#: views.py:28
-msgid "Profile has been changed."
-msgstr "Profil został zmieniony."
-
-#: views.py:42
-msgid "Password has been changed."
-msgstr "Hasło zostało zmienione."
-
-#: templates/account/profile.html:8
-msgid "Change at Gravatar.com"
-msgstr "Zmień na Gravatar.com"
-
-#: templates/account/profile.html:9
-msgid "Logout"
-msgstr "Wyloguj"
-
-#: templates/account/profile.html:19
-msgid "Your profile"
-msgstr "Twój profil"
-
-#: templates/account/profile.html:24
-msgid "Change profile"
-msgstr "Zmień profil"
-
-#: templates/account/profile.html:28
-msgid "Password change"
-msgstr "Zmiana hasła"
-
-#: templates/account/profile.html:33
-msgid "Change password"
-msgstr "Zmień hasło"
-
-#: templates/account/profile.html:40
-msgid "Sign in to:"
-msgstr "Zaloguj do:"
-
diff --git a/src/accounts/migrations/0002_servicegroup_serviceuser.py b/src/accounts/migrations/0002_servicegroup_serviceuser.py
new file mode 100644 (file)
index 0000000..5e45aab
--- /dev/null
@@ -0,0 +1,33 @@
+# Generated by Django 2.1.7 on 2019-03-29 13:22
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+        ('auth', '0009_alter_user_last_name_max_length'),
+        ('accounts', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='ServiceGroup',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='auth.Group')),
+                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounts.Service')),
+            ],
+        ),
+        migrations.CreateModel(
+            name='ServiceUser',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounts.Service')),
+                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+            ],
+        ),
+    ]
index 819fcc0..b0bd496 100644 (file)
@@ -1,3 +1,4 @@
+from django.conf import settings
 from django.db import models
 from cas_provider.signals import cas_collect_custom_attributes
 
@@ -12,6 +13,16 @@ class Service(models.Model):
         ordering = ('ordering', )
 
 
+class ServiceUser(models.Model):
+    service = models.ForeignKey(Service, on_delete=models.CASCADE)
+    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
+
+
+class ServiceGroup(models.Model):
+    service = models.ForeignKey(Service, on_delete=models.CASCADE)
+    group = models.ForeignKey('auth.Group', on_delete=models.CASCADE)
+
+
 def user_attributes(sender, user, **kwargs):
     return {
         'firstname': user.first_name,
diff --git a/src/accounts/templates/account/base.html b/src/accounts/templates/account/base.html
new file mode 100644 (file)
index 0000000..c15aaad
--- /dev/null
@@ -0,0 +1,28 @@
+{% extends "base.html" %}
+{% load gravatar i18n %}
+
+{% block content %}
+  <aside class="menu">
+    <img src="{% gravatar_url request.user.email 120 %}"
+         alt="Gravatar"
+         title="{% trans 'Change at Gravatar.com' %}">
+    {% block menu %}
+      <p><a {% if menu == 'profile' %}class="active"{% endif %} href="{% url 'accounts_profile' %}">{% trans "Your profile" %}</a></p>
+      <p><a {% if menu == 'password' %}class="active"{% endif %} href="{% url 'password_change' %}">{% trans "Password change" %}</a></p>
+      <!--p><a {% if menu == 'email' %}class="active"{% endif %} href="">{% trans "E-mail" %}</a></p-->
+      <!--p><a {% if menu == 'ssh' %}class="active"{% endif %} href="">{% trans "SSH keys" %}</a></p-->
+    {% endblock %}
+    <p><a href="{% url 'cas_logout' %}">{% trans "Logout" %}</a></p>
+  </aside>
+
+  <div id="details">
+    {% if messages %}
+      <section id="messages">
+        {% for message in messages %}<p>{{ message }}</p>{% endfor %}
+      </section>
+    {% endif %}
+      
+    {% block accounts-content %}
+    {% endblock %}
+  </div>
+{% endblock %}
index 6c907cc..18bada0 100644 (file)
@@ -1,48 +1,22 @@
-{% extends "base.html" %}
-{% load gravatar i18n %}
+{% extends "account/base.html" %}
+{% load i18n %}
 
-{% block content %}
-       <aside class="user_avatar">
-               <img src="{% gravatar_url request.user.email 120 %}"
-            alt="Gravatar"
-            title="{% trans 'Change at Gravatar.com' %}">
-               <p><a href="{% url 'cas_logout' %}">{% trans "Logout" %}</a></p>
-       </aside>
 
-       <div id="details">
-               {% if messages %}
-            <section id="messages">
-                {% for message in messages %}<p>{{ message }}</p>{% endfor %}
-            </section>
-       {% endif %}
+{% block title %}{% trans "Your profile" %}{% endblock %}
 
-    <h2>{% trans "Your profile" %}</h2>
-    <form method="post" action="/accounts/change_profile">
-    {% csrf_token %}
-       <table>
-               {{ basic_form.as_table }}
-                       <tr><td colspan="2"><button type="submit">{% trans "Change profile" %}</button></td></tr>
-               </table>
-       </form>
 
-       <h2>{% trans "Password change" %}</h2>
-       <form method="post" action="/accounts/change_password">
-    {% csrf_token %}
-       <table>
-               {{ pass_form.as_table }}
-               <tr><td colspan="2"><button type="submit">{% trans "Change password" %}</button></td></tr>
-               </table>
-       </form>
-       </div>
+{% block menu %}
+  {% with menu="profile" %}
+    {{ block.super }}
+  {% endwith %}
+{% endblock %}
 
-    {% if services %}
-       <section id="services-list">
-        <h1>{% trans "Sign in to:" %}</h1>
-        {% for service in services %}
-            <a href="{{ service.url }}" title="{{ service.name }}">
-                <img src="{{ service.image.url }}" alt="{{ service.name }}">
-            </a>
-        {% endfor %}
-       </section>
-    {% endif %}
+
+{% block accounts-content %}
+  <h1>{% trans "Your profile" %}</h1>
+  <form method="post">
+    {% csrf_token %}
+    {{ form.as_p }}
+    <p><button type="submit">{% trans "Change profile" %}</button></p>
+  </form>
 {% endblock %}
diff --git a/src/accounts/templates/registration/password_change_done.html b/src/accounts/templates/registration/password_change_done.html
new file mode 100644 (file)
index 0000000..cc41fa7
--- /dev/null
@@ -0,0 +1,16 @@
+{% extends "account/base.html" %}
+{% load i18n %}
+
+{% block title %}{{ title }}{% endblock %}
+
+{% block menu %}
+  {% with menu='password' %}
+    {{ block.super }}
+  {% endwith %}
+{% endblock %}
+
+
+{% block accounts-content %}
+  <h1>{% trans 'Password change' %}</h1>
+  <p>{% trans 'Your password was changed.' %}</p>
+{% endblock %}
diff --git a/src/accounts/templates/registration/password_change_form.html b/src/accounts/templates/registration/password_change_form.html
new file mode 100644 (file)
index 0000000..c968ee5
--- /dev/null
@@ -0,0 +1,39 @@
+{% extends "account/base.html" %}
+{% load i18n static %}
+
+{% block title %}{{ title }}{% endblock %}
+
+
+{% block menu %}
+  {% with menu='password' %}
+    {{ block.super }}
+  {% endwith %}
+{% endblock %}
+
+
+{% block accounts-content %}
+  <h1>{{ title }}</h1>
+
+  <form method="post">
+    {% csrf_token %}
+    {% if form.errors %}
+      <p class="errornote">
+        {% if form.errors.items|length == 1 %}
+          {% trans "Please correct the error below." %}
+        {% else %}
+          {% trans "Please correct the errors below." %}
+        {% endif %}
+      </p>
+    {% endif %}
+
+    <p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
+
+    {{ form.as_p }}
+
+    <p>
+      <input type="submit" value="{% trans 'Change my password' %}">
+    </p>
+
+  </form>
+
+{% endblock %}
diff --git a/src/accounts/templates/registration/password_reset_complete.html b/src/accounts/templates/registration/password_reset_complete.html
new file mode 100644 (file)
index 0000000..59497d3
--- /dev/null
@@ -0,0 +1,18 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+
+{% block title %}{{ title }}{% endblock %}
+
+
+{% block content %}
+<div class="enclose">
+  <div class="enclosed">
+    <h1>{{ title }}</h1>
+
+    <p>{% trans "Your password has been set.  You may go ahead and log in now." %}</p>
+
+    <p><a href="{{ login_url }}">{% trans 'Log in' %}</a></p>
+  </div>
+</div>
+{% endblock %}
diff --git a/src/accounts/templates/registration/password_reset_confirm.html b/src/accounts/templates/registration/password_reset_confirm.html
new file mode 100644 (file)
index 0000000..e8292ab
--- /dev/null
@@ -0,0 +1,28 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+
+{% block title %}{{ title }}{% endblock %}
+
+
+{% block content %}
+<div class="enclose">
+  <div class="enclosed">
+    <h1>{{ title }}</h1>
+
+    {% if validlink %}
+
+      <p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
+
+      <form method="post">
+        {% csrf_token %}
+        {{ form.as_p }}
+        <button type="submit">{% trans 'Change my password' %}</button>
+      </form>
+
+    {% else %}
+      <p>{% trans "The password reset link was invalid, possibly because it has already been used.  Please request a new password reset." %}</p>
+    {% endif %}
+  </div>
+</div>
+{% endblock %}
diff --git a/src/accounts/templates/registration/password_reset_done.html b/src/accounts/templates/registration/password_reset_done.html
new file mode 100644 (file)
index 0000000..265239a
--- /dev/null
@@ -0,0 +1,19 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+
+{% block title %}{{ title }}{% endblock %}
+
+
+
+{% block content %}
+<div class="enclose">
+  <div class="enclosed">
+    <h1>{{ title }}</h1>
+
+    <p>{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}</p>
+
+    <p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p>
+  </div>
+</div>
+{% endblock %}
diff --git a/src/accounts/templates/registration/password_reset_email.html b/src/accounts/templates/registration/password_reset_email.html
new file mode 100644 (file)
index 0000000..b2fa480
--- /dev/null
@@ -0,0 +1,9 @@
+{% load i18n %}{% autoescape off %}
+{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
+
+{% trans "Please go to the following page and choose a new password:" %}
+{% block reset_link %}
+{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
+{% endblock %}
+{% trans "Your username, in case you've forgotten:" %} {{ user.get_username }}
+{% endautoescape %}
diff --git a/src/accounts/templates/registration/password_reset_form.html b/src/accounts/templates/registration/password_reset_form.html
new file mode 100644 (file)
index 0000000..88d609e
--- /dev/null
@@ -0,0 +1,19 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block title %}{{ title }}{% endblock %}
+
+{% block content %}
+<div class="enclose">
+  <form class="enclosed" method="post">
+    {% csrf_token %}
+    <h1>{{ title }}</h1>
+
+    <p>{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}</p>
+
+    {{ form.as_p }}
+
+    <button type="submit">{% trans 'Reset my password' %}</button>
+  </form>
+</div>
+{% endblock %}
index 6a18733..7584fc1 100644 (file)
@@ -1,9 +1,7 @@
-# -*- coding: utf-8 -*-
 from django.conf.urls import url
 from . import views
 
+
 urlpatterns = [
-    url(r'^$', views.account_profile),
-    url(r'^change_profile$', views.account_change_basic_profile),
-    url(r'^change_password$', views.account_change_password),
+    url(r'^$', views.ProfileView.as_view(), name='accounts_profile'),
 ]
index 9a95608..2b049e4 100644 (file)
@@ -1,46 +1,19 @@
-# Create your views here.
-from django import http
-from django.contrib.auth.decorators import login_required
-from django.contrib.auth import update_session_auth_hash
+from django.contrib.auth.mixins import LoginRequiredMixin
 from django.contrib import messages
-from django.shortcuts import render
 from django.utils.translation import ugettext as _
-from django.views.decorators.http import require_POST
-from accounts.forms import UserBasicForm, UserPasswordForm
-from .models import Service
+from django.views.generic.edit import UpdateView
+from accounts.forms import UserBasicForm
 
-@login_required
-def account_profile(request, basic_form=None, pass_form=None):
-    return render(request, "account/profile.html", {
-        "basic_form": basic_form or UserBasicForm(instance=request.user),
-        "pass_form": pass_form or UserPasswordForm(),
-        "services": Service.objects.all(),
-    })
 
+class ProfileView(LoginRequiredMixin, UpdateView):
+    form_class = UserBasicForm
+    template_name = "account/profile.html"
+    success_url = '/accounts/'
 
-@require_POST
-@login_required
-def account_change_basic_profile(request):
-    form = UserBasicForm(request.POST, instance=request.user)
+    def get_object(self):
+        return self.request.user
 
-    if form.is_valid():
-        form.save()
-        messages.add_message(request, messages.INFO, _("Profile has been changed."))
-        return http.HttpResponseRedirect('/accounts/')
-
-    return account_profile(request, basic_form=form)
-
-@require_POST
-@login_required
-def account_change_password(request):
-    form = UserPasswordForm(request.POST)
-
-    if form.is_valid():
-        request.user.set_password(form.cleaned_data['new_password'])
-        request.user.save()
-        update_session_auth_hash(request, request.user)
-
-        messages.add_message(request, messages.INFO, _("Password has been changed."))
-        return http.HttpResponseRedirect('/accounts/')
-
-    return account_profile(request, pass_form=form)
+    def form_valid(self, form):
+        retval = super().form_valid(form)
+        messages.add_message(self.request, messages.INFO, _("Profile has been changed."))
+        return retval
index e155fa0..deae1a4 100644 (file)
Binary files a/src/cas/locale/pl/LC_MESSAGES/django.mo and b/src/cas/locale/pl/LC_MESSAGES/django.mo differ
index 7a56631..5cfa122 100644 (file)
@@ -5,28 +5,33 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-03-20 16:31+0100\n"
-"PO-Revision-Date: 2013-03-20 16:04+0100\n"
+"POT-Creation-Date: 2019-03-29 14:16+0100\n"
+"PO-Revision-Date: 2019-03-29 14:16+0100\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"Language: \n"
+"Language: pl\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
 "|| n%100>=20) ? 1 : 2);\n"
+"Language-Team: \n"
+"X-Generator: Poedit 2.0.6\n"
 
 #: templates/cas/login.html:9
 msgid "Login"
 msgstr "Zaloguj"
 
-#: templates/cas/login.html:16
+#: templates/cas/login.html:20
 msgid "Log me in"
 msgstr "Zaloguj mnie"
 
-#: templates/cas/logout.html:5 templates/cas/logout.html.py:12
+#: templates/cas/login.html:23
+msgid "Forgot password?"
+msgstr "Nie pamiętasz hasła?"
+
+#: templates/cas/logout.html:5 templates/cas/logout.html:12
 msgid "Logged out"
 msgstr "Wylogowano"
 
index 1883595..62725c7 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 from os import path
 
 PROJECT_ROOT = path.realpath(path.dirname(__file__))
@@ -84,6 +83,11 @@ LOCALE_PATHS = (
 )
 
 INSTALLED_APPS = (
+    'accounts',
+
+    'cas_provider',
+    'django_gravatar',
+
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
@@ -91,11 +95,6 @@ INSTALLED_APPS = (
     'django.contrib.admin',
     'django.contrib.admindocs',
     'django.contrib.staticfiles',
-
-    'cas_provider',
-    'django_gravatar',
-
-    'accounts',
 )
 
 MIDDLEWARE = (
index 4d62c01..be4aa1c 100644 (file)
@@ -1,18 +1,19 @@
+* {
+    box-sizing: border-box;
+}
+
 .enclose {
-    text-align: center;
-    min-height: 500px;
-    background: url(../brackets.png) no-repeat 50% 0;
-    margin-top: 1em;
+    height: 450px;
+    background: url("../brackets.png") no-repeat 50% 0;
+    margin: 1em 0;
     background-size: auto 450px;
+    display: flex;
+    flex-direction: column;
 }
 
 .enclosed {
-    margin-top: 70px;
-    display: inline-block;
-    text-align: left;
     max-width: 300px;
-    background-color: rgb(247, 247, 247);
-    background-color: rgba(247, 247, 247, .5);
+    margin: auto;
 }
 
 a {
@@ -30,25 +31,31 @@ a:hover {
 }
 
 
-form p {
-    margin: 0;
-}
-form label, form input {
+form label, form input, form button {
     display: block;
     width: 100%;
 }
-#login-form input {
+
+.enclosed input {
     font-size: 1.75em;
     margin-bottom: .4em;
+    width: 100%;
+}
+.enclosed button {
+    font-size: 1.75em;
+    width: 100%;
+    margin-bottom: 0;
+}
+.enclosed p {
+    margin-bottom: 0;
+}
+h1 {
+    font-size: 1.75em;
+    margin: 0 0 16px;
 }
-
-
-
-
 html, body {
     margin: 0;
     padding: 0;
-    height: 100%;
 }
 body {
     background-color: #F7F7F7;
@@ -78,11 +85,9 @@ footer, #content_push {
     margin: auto;
 }
 
-
 #details {
-       margin: 1em;
-       float: left;
-       max-width: 75%;
+    margin: 1em 0;
+    padding: 0 2em;
 }
 
 #details form table th {
@@ -105,32 +110,26 @@ footer, #content_push {
     color: green;
 }
 
-#details h2 {
-    margin-top: 0;
-}
-
-.user_avatar {
-       float: left;
-       margin: 1em;
-       max-width: 20%;
-       text-align: center;
-}
-
-.user_avatar img {
-    box-shadow: 0 0 .2em black;
+.menu {
+    margin: 1em 0;
+    text-align: center;
 }
-
-#services-list {
-    clear: both;
-    border-top: 1px solid black;
+.menu .active {
+    font-weight: bold;
+    color: black;
 }
+@media screen and (min-width: 620px) {
+    .menu {
+        float: left;
+        max-width: 20%;
+    }
 
-#services-list h1 {
-    margin-bottom: 0;
+    #details {
+        float: right;
+        width: 80%;
+    }
 }
 
-#services-list img {
-       width: 90px;
-    height: 50px;
-       margin: 10px 10px 0 0;
+.menu img {
+    box-shadow: 0 0 .2em black;
 }
index 11f9ce8..570e404 100644 (file)
@@ -1,29 +1,30 @@
 <!DOCTYPE html>
 <html>
-    {% load static %}
-    <head>
-        <meta charset="utf-8" />
-        <title>{% block title %}Fundacja Nowoczesna Polska - Logowanie{% block subtitle %}{% endblock subtitle %}{% endblock title%}</title>
-        <link rel="stylesheet" href="{% static 'css/main.css' %}"/>
-        {% block extrahead %}
-        {% endblock %}
-    </head>
-    <body>
+  {% load static %}
+  <head>
+    <meta charset="utf-8" />
+    <title>{% block title %}Logowanie{% endblock %} | Fundacja Nowoczesna Polska</title>
+    <link rel="stylesheet" href="{% static 'css/main.css' %}"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    {% block extrahead %}
+    {% endblock %}
+  </head>
+  <body>
     <div id="header-wrap">
-    <header>
-
+      <header>
         <a href="/">
-            <img title="Fundacja Nowoczesna Polska"
-                alt="Fundacja Nowoczesna Polska"
-                src="{% static 'fnp_black.png' %}"></a>
-
-    </header>
+          <img title="Fundacja Nowoczesna Polska"
+               alt="Fundacja Nowoczesna Polska"
+               src="{% static 'fnp_black.png' %}">
+        </a>
+      </header>
     </div>
 
     <div id="content-wrap">
-    <div id="content">
-        {% block content %} {% endblock %}
-    </div>
+      <div id="content">
+        {% block content %}{% endblock %}
+      </div>
     </div>
 
+  </body>
 </html>
index b1b9025..3ff374f 100644 (file)
     {{ form.as_p }}
     <input type="submit" value="{% trans 'Log me in' %}" tabindex="10" />
 
+    <div style="text-align: right">
+      <a href="{% url 'password_reset' %}">{% trans "Forgot password?" %}</a>
+    </div>
+
   </form>
 </div>
 
index 2d44e70..297b82b 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 from django.urls import path, include
 from django.views.generic import RedirectView
 from django.contrib import admin
@@ -17,6 +16,7 @@ urlpatterns = [
     path('admin/', admin.site.urls),
 
     path('accounts/', include('accounts.urls')),
+    path('auth/', include('django.contrib.auth.urls')),
 ]