From 3a65fcbfa423d5627e41c2f9e17c464d4a594087 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 29 Mar 2019 14:25:08 +0100 Subject: [PATCH] Password reset, standardize some stuff. --- .gitignore | 1 + src/accounts/forms.py | 22 +-- src/accounts/locale/pl/LC_MESSAGES/django.mo | Bin 0 -> 705 bytes src/accounts/locale/pl/LC_MESSAGES/django.po | 132 ++++++++++++++++++ .../locale/pl_PL/LC_MESSAGES/django.mo | Bin 1100 -> 0 bytes .../locale/pl_PL/LC_MESSAGES/django.po | 66 --------- .../0002_servicegroup_serviceuser.py | 33 +++++ src/accounts/models.py | 11 ++ src/accounts/templates/account/base.html | 28 ++++ src/accounts/templates/account/profile.html | 58 +++----- .../registration/password_change_done.html | 16 +++ .../registration/password_change_form.html | 39 ++++++ .../registration/password_reset_complete.html | 18 +++ .../registration/password_reset_confirm.html | 28 ++++ .../registration/password_reset_done.html | 19 +++ .../registration/password_reset_email.html | 9 ++ .../registration/password_reset_form.html | 19 +++ src/accounts/urls.py | 6 +- src/accounts/views.py | 53 ++----- src/cas/locale/pl/LC_MESSAGES/django.mo | Bin 1156 -> 1164 bytes src/cas/locale/pl/LC_MESSAGES/django.po | 19 ++- src/cas/settings.py | 11 +- src/cas/static/css/main.css | 91 ++++++------ src/cas/templates/base.html | 39 +++--- src/cas/templates/cas/login.html | 4 + src/cas/urls.py | 2 +- 26 files changed, 474 insertions(+), 250 deletions(-) create mode 100644 src/accounts/locale/pl/LC_MESSAGES/django.mo create mode 100644 src/accounts/locale/pl/LC_MESSAGES/django.po delete mode 100644 src/accounts/locale/pl_PL/LC_MESSAGES/django.mo delete mode 100644 src/accounts/locale/pl_PL/LC_MESSAGES/django.po create mode 100644 src/accounts/migrations/0002_servicegroup_serviceuser.py create mode 100644 src/accounts/templates/account/base.html create mode 100644 src/accounts/templates/registration/password_change_done.html create mode 100644 src/accounts/templates/registration/password_change_form.html create mode 100644 src/accounts/templates/registration/password_reset_complete.html create mode 100644 src/accounts/templates/registration/password_reset_confirm.html create mode 100644 src/accounts/templates/registration/password_reset_done.html create mode 100644 src/accounts/templates/registration/password_reset_email.html create mode 100644 src/accounts/templates/registration/password_reset_form.html diff --git a/.gitignore b/.gitignore index 999c6ae..e3690f6 100755 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ localsettings.py /media /static +*~ diff --git a/src/accounts/forms.py b/src/accounts/forms.py index 5dcb842..0c8cb66 100644 --- a/src/accounts/forms.py +++ b/src/accounts/forms.py @@ -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 index 0000000000000000000000000000000000000000..99a7b83a25818310ca94de7af16f5c273a66e84f GIT binary patch literal 705 zcmY+BON-P%5XW0xAH>JOgCcmSyL3#(2fOisIF9S$4i2;N?WH!U&1NRk9lAR^&YVO9 zkDk2w1w89FkOln`;y3W-O|W_%EEfFoCzbkFSGs{lj{J`OEko=MM>SiWOMp0`Gr$ScucChSmGuupVc9&+7djSOeD2tls~X zmF=@Q%1_^$Q?u|sA1lle#`hELT~q}DI#@TjhYn4c>CrM>8@*FjBsy}0WhFLsp&KW9 z^DOM5g>51Q*{n$(imj~&FrE`+YWlnD7@(CGRYL!6Hr&=2)yS6BEdABL7 zOf{!_k7S?rN?#=Jp`!#^QM@LjE3&l)@zo^0b}5RZDA+{nWNJ{^3Y|6y^f9L)w5K>2 zBHT2XYyL70vsvPf(qo-X$ttXMWrrAQQ-pPOoBODu!GdH;IO6k{?+MgZ(B0^E4n~f{ zC}?ZtNb$*&nn!c=+Fh, 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 \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 index 63b2a7dc7a5a65fc46b3e8370876f7583888d007..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1100 zcmZ{i&rcIU6vtOZ#i|%NXfz%kM`NaTQ4_MFg0%v%KvOFINIVR?!?LBF+00H^X`%;% zC(j-@`WG0(p8#C+Z_vAmM{i#I&UV{|7$=f{8bK05DKx|(K zcTPgk#*s4$4WU^MJFipT;4&1%4b5r3#SPa*U$y(!F;9|I>0qF1wH~#EQ&pkr7^jw- z$R)tO?B|WOmmY>YdRcN(RUs+gQDxiSUhAk#x6tIV#Fkubl zQK7cnU}cTc2x5=Wfk%@i_ZBPNX6_wwUC(uIlqO3hII_Cfifr=#`nm9{^2D%)<}zt< zqqIkL9*9jUcX@M@)3oM+f+a2b*~N@hsq(ubkvvwdWRn+_4vTT?KJv)0!$ZLug10@Y z&MwV8wew6@t23?0x($6W$Kt|bWjMTBEEUR18X?ikc8sBncx`UREgs3c_L+1d%)O_L z$82ioXM0{3npLE)f=GrQO|3U2= zG9T{DXRg#$iQ$N$E)q+8Pf_ffB8pXN_V;ub20=-5uuJw&H{=1n*TMV#3iXo=a%^Mi g@=zq~RYX@j>jPWpIgJ!cf@Mqx)<(L&*QC7Vzv4+Mf&c&j 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 index dbd98d8..0000000 --- a/src/accounts/locale/pl_PL/LC_MESSAGES/django.po +++ /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 , 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 \n" -"Language-Team: LANGUAGE \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 index 0000000..5e45aab --- /dev/null +++ b/src/accounts/migrations/0002_servicegroup_serviceuser.py @@ -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)), + ], + ), + ] diff --git a/src/accounts/models.py b/src/accounts/models.py index 819fcc0..b0bd496 100644 --- a/src/accounts/models.py +++ b/src/accounts/models.py @@ -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 index 0000000..c15aaad --- /dev/null +++ b/src/accounts/templates/account/base.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} +{% load gravatar i18n %} + +{% block content %} + + +
+ {% if messages %} +
+ {% for message in messages %}

{{ message }}

{% endfor %} +
+ {% endif %} + + {% block accounts-content %} + {% endblock %} +
+{% endblock %} diff --git a/src/accounts/templates/account/profile.html b/src/accounts/templates/account/profile.html index 6c907cc..18bada0 100644 --- a/src/accounts/templates/account/profile.html +++ b/src/accounts/templates/account/profile.html @@ -1,48 +1,22 @@ -{% extends "base.html" %} -{% load gravatar i18n %} +{% extends "account/base.html" %} +{% load i18n %} -{% block content %} - -
- {% if messages %} -
- {% for message in messages %}

{{ message }}

{% endfor %} -
- {% endif %} +{% block title %}{% trans "Your profile" %}{% endblock %} -

{% trans "Your profile" %}

-
- {% csrf_token %} - - {{ basic_form.as_table }} - -
-
-

{% trans "Password change" %}

-
- {% csrf_token %} - - {{ pass_form.as_table }} - -
-
-
+{% block menu %} + {% with menu="profile" %} + {{ block.super }} + {% endwith %} +{% endblock %} - {% if services %} -
-

{% trans "Sign in to:" %}

- {% for service in services %} - - {{ service.name }} - - {% endfor %} -
- {% endif %} + +{% block accounts-content %} +

{% trans "Your profile" %}

+
+ {% csrf_token %} + {{ form.as_p }} +

+
{% 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 index 0000000..cc41fa7 --- /dev/null +++ b/src/accounts/templates/registration/password_change_done.html @@ -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 %} +

{% trans 'Password change' %}

+

{% trans 'Your password was changed.' %}

+{% 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 index 0000000..c968ee5 --- /dev/null +++ b/src/accounts/templates/registration/password_change_form.html @@ -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 %} +

{{ title }}

+ +
+ {% csrf_token %} + {% if form.errors %} +

+ {% if form.errors.items|length == 1 %} + {% trans "Please correct the error below." %} + {% else %} + {% trans "Please correct the errors below." %} + {% endif %} +

+ {% endif %} + +

{% 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." %}

+ + {{ form.as_p }} + +

+ +

+ +
+ +{% 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 index 0000000..59497d3 --- /dev/null +++ b/src/accounts/templates/registration/password_reset_complete.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load i18n %} + + +{% block title %}{{ title }}{% endblock %} + + +{% block content %} +
+
+

{{ title }}

+ +

{% trans "Your password has been set. You may go ahead and log in now." %}

+ +

{% trans 'Log in' %}

+
+
+{% 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 index 0000000..e8292ab --- /dev/null +++ b/src/accounts/templates/registration/password_reset_confirm.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} +{% load i18n %} + + +{% block title %}{{ title }}{% endblock %} + + +{% block content %} +
+
+

{{ title }}

+ + {% if validlink %} + +

{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}

+ +
+ {% csrf_token %} + {{ form.as_p }} + +
+ + {% else %} +

{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}

+ {% endif %} +
+
+{% 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 index 0000000..265239a --- /dev/null +++ b/src/accounts/templates/registration/password_reset_done.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} +{% load i18n %} + + +{% block title %}{{ title }}{% endblock %} + + + +{% block content %} +
+
+

{{ title }}

+ +

{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}

+ +

{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}

+
+
+{% 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 index 0000000..b2fa480 --- /dev/null +++ b/src/accounts/templates/registration/password_reset_email.html @@ -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 index 0000000..88d609e --- /dev/null +++ b/src/accounts/templates/registration/password_reset_form.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{{ title }}{% endblock %} + +{% block content %} +
+
+ {% csrf_token %} +

{{ title }}

+ +

{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}

+ + {{ form.as_p }} + + +
+
+{% endblock %} diff --git a/src/accounts/urls.py b/src/accounts/urls.py index 6a18733..7584fc1 100644 --- a/src/accounts/urls.py +++ b/src/accounts/urls.py @@ -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'), ] diff --git a/src/accounts/views.py b/src/accounts/views.py index 9a95608..2b049e4 100644 --- a/src/accounts/views.py +++ b/src/accounts/views.py @@ -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 diff --git a/src/cas/locale/pl/LC_MESSAGES/django.mo b/src/cas/locale/pl/LC_MESSAGES/django.mo index e155fa0a1651debbe60e9a891030ea08ff561285..deae1a4e5c16d591d73648c0faed387e94ed7139 100644 GIT binary patch delta 370 zcmW;Gy-UMD7zXe+Y5YiZ5C^9YHy5s?u@oAIVv)G`QA!aJmxCTLV0$rlRd5lCn@$!% z!OhW0TpUFd^j~lg1ZSPxebN_x_uL0B_nx}v?#bu8b4jRaD8eqxzzyW}26ONZE_{Fo z-!K8cP=!B;pkxs#4&7qY#Kj$Q3HgH*$dW^ZUa|q( zap5U%8h@N$Oy&zJAD$wW#mcZ$XnmxzZsY#3XoX%|rYbXhUB^k6HwUri9ThUKwaMG^ zFwu$X^A%xa$O6Ao=l&uO>a0=?E45K%Z#f}L_ean6)AE|=#{&^d-jSk*{%yW0`!W+o mWg%-R*-Z=!%6_@#(MBRML@#-{HbNh>J)vKRqVX^+*w#NTR7c1F delta 374 zcmeC-Y~ifGC&V(90SMTESO$ngfS4PIdw>`Ob^tLa5bp$HE+9S(#H>Jk4v0;F_zDoa z0Wl{d14BNL4gk`JfcO9q^8oqH%n*GOfHcUC*+AL}NG}G`)(i}m49|d!M4*5Y3j+gC z4+9er1BJil2j`NBLhQYT?1oXBLf9PGb;l_Z39CC z1E50PpwzO=Vw~zsAnJS)i%WDviYD7Id8+A#q$cKCDfl@0xrc(>V&miEkdvvGUzBdg X<&&6~UYeK=v~O}J(}B%h%uI{`7V<>0 diff --git a/src/cas/locale/pl/LC_MESSAGES/django.po b/src/cas/locale/pl/LC_MESSAGES/django.po index 7a56631..5cfa122 100644 --- a/src/cas/locale/pl/LC_MESSAGES/django.po +++ b/src/cas/locale/pl/LC_MESSAGES/django.po @@ -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 \n" -"Language-Team: LANGUAGE \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" diff --git a/src/cas/settings.py b/src/cas/settings.py index 1883595..62725c7 100644 --- a/src/cas/settings.py +++ b/src/cas/settings.py @@ -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 = ( diff --git a/src/cas/static/css/main.css b/src/cas/static/css/main.css index 4d62c01..be4aa1c 100644 --- a/src/cas/static/css/main.css +++ b/src/cas/static/css/main.css @@ -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; } diff --git a/src/cas/templates/base.html b/src/cas/templates/base.html index 11f9ce8..570e404 100644 --- a/src/cas/templates/base.html +++ b/src/cas/templates/base.html @@ -1,29 +1,30 @@ - {% load static %} - - - {% block title %}Fundacja Nowoczesna Polska - Logowanie{% block subtitle %}{% endblock subtitle %}{% endblock title%} - - {% block extrahead %} - {% endblock %} - - + {% load static %} + + + {% block title %}Logowanie{% endblock %} | Fundacja Nowoczesna Polska + + + {% block extrahead %} + {% endblock %} + +
-
- +
- Fundacja Nowoczesna Polska - -
+ Fundacja Nowoczesna Polska + +
-
- {% block content %} {% endblock %} -
+
+ {% block content %}{% endblock %} +
+ diff --git a/src/cas/templates/cas/login.html b/src/cas/templates/cas/login.html index b1b9025..3ff374f 100644 --- a/src/cas/templates/cas/login.html +++ b/src/cas/templates/cas/login.html @@ -19,6 +19,10 @@ {{ form.as_p }} + + diff --git a/src/cas/urls.py b/src/cas/urls.py index 2d44e70..297b82b 100644 --- a/src/cas/urls.py +++ b/src/cas/urls.py @@ -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')), ] -- 2.20.1