From 3f21dd295c0d1178b8ef58f279c759c74547613e Mon Sep 17 00:00:00 2001 From: LongHairedHacker Date: Tue, 2 May 2017 21:33:23 +0200 Subject: [PATCH] Finished usermanagement --- templates/base.html | 16 ++- users/forms.py | 9 ++ users/signup.html | 186 +++++++++++++++++++++++++ users/templates/users/user_edit.html | 181 ++++++++++++++++++++++++ users/templates/users/user_update.html | 180 ++++++++++++++++++++++++ users/urls.py | 2 +- users/views.py | 2 +- 7 files changed, 569 insertions(+), 7 deletions(-) create mode 100644 users/signup.html create mode 100644 users/templates/users/user_edit.html create mode 100644 users/templates/users/user_update.html diff --git a/templates/base.html b/templates/base.html index af53617..9fd5555 100644 --- a/templates/base.html +++ b/templates/base.html @@ -18,8 +18,10 @@ - Roms - Upload Rom + Roms + {% if user.is_authenticated %} + Rom Hochladen + {% endif %} @@ -29,13 +31,17 @@ diff --git a/users/forms.py b/users/forms.py index 54775a5..459bade 100644 --- a/users/forms.py +++ b/users/forms.py @@ -72,6 +72,15 @@ class UserUpdateForm(ModelForm): return current_password + def clean_new_password1(self): + password1 = self.cleaned_data.get("new_password1") + + if password1 != '': + validate_password(password1) + + return password1 + + def clean_new_password2(self): password1 = self.cleaned_data.get("new_password1") password2 = self.cleaned_data.get("new_password2") diff --git a/users/signup.html b/users/signup.html new file mode 100644 index 0000000..c218e60 --- /dev/null +++ b/users/signup.html @@ -0,0 +1,186 @@ +{% extends "base.html" %} + +{% block title %}Registrieren{% endblock %} + +{% block content %} +
+
+
+
+

Registrieren

+ {% if user.is_authenticated %} + Was zur Hölle machst du bitte hier?
+ Du bist eingeloggt und willst du dich registrieren.
+ Geh heim du bist besoffen! + {% else %} +
+ {% csrf_token %} + +
+
+ +
+
+
+
+ + + + + + {% if form.username.errors %} + + {% endif %} + +
+

+ {{form.username.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.email.errors %} + + {% endif %} + +
+

+ {{form.email.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.password1.errors %} + + {% endif %} + +
+

+ {{form.password1.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.password2.errors %} + + {% endif %} + +
+

+ {{form.password2.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.twitter.errors %} + + {% endif %} + +
+

+ {{form.twitter.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.github.errors %} + + {% endif %} + +
+

+ {{form.github.errors.as_text}} +

+
+
+
+ +
+

+ +

+
+
+ {% endif %} +
+
+
+
+{% endblock %} diff --git a/users/templates/users/user_edit.html b/users/templates/users/user_edit.html new file mode 100644 index 0000000..ec7e5e6 --- /dev/null +++ b/users/templates/users/user_edit.html @@ -0,0 +1,181 @@ +{% extends "base.html" %} + +{% block title %}Profil bearbeiten{% endblock %} + +{% block content %} +
+
+
+
+

Profil bearbeiten

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

+ {{form.email.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.current_password.errors %} + + {% endif %} + +
+

+ {{form.current_password.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.new_password1.errors %} + + {% endif %} + +
+

+ {{form.new_password1.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.new_password2.errors %} + + {% endif %} + +
+

+ {{form.new_password2.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.twitter.errors %} + + {% endif %} + +
+

+ {{form.twitter.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.github.errors %} + + {% endif %} + +
+

+ {{form.github.errors.as_text}} +

+
+
+
+ +
+

+ +

+
+
+ {% endif %} +
+
+
+
+{% endblock %} diff --git a/users/templates/users/user_update.html b/users/templates/users/user_update.html new file mode 100644 index 0000000..b35d1b2 --- /dev/null +++ b/users/templates/users/user_update.html @@ -0,0 +1,180 @@ +{% extends "base.html" %} + +{% block title %}Profil bearbeiten{% endblock %} + +{% block content %} +
+
+
+
+

Profil bearbeiten

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

+ {{form.email.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.current_password.errors %} + + {% endif %} + +
+

+ {{form.current_password.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.new_password1.errors %} + + {% endif %} + +
+

+ {{form.new_password1.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.new_password2.errors %} + + {% endif %} + +
+

+ {{form.new_password2.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.twitter.errors %} + + {% endif %} + +
+

+ {{form.twitter.errors.as_text}} +

+
+
+
+ +
+
+ +
+
+
+
+ + + + + + {% if form.github.errors %} + + {% endif %} + +
+

+ {{form.github.errors.as_text}} +

+
+
+
+ +
+

+ +

+
+
+
+
+
+
+{% endblock %} diff --git a/users/urls.py b/users/urls.py index 63a426f..14490e5 100644 --- a/users/urls.py +++ b/users/urls.py @@ -26,5 +26,5 @@ urlpatterns = [ name='password_reset_sent'), url(r'^login/$', login, {'template_name' : 'users/login.html'}, name='login'), - url(r'^logout/$', logout ,{'next_page' : reverse_lazy('login')}, name='logout'), + url(r'^logout/$', logout ,{'next_page' : reverse_lazy('login')}, name='logout') ] diff --git a/users/views.py b/users/views.py index 1d3aa0f..e166e67 100644 --- a/users/views.py +++ b/users/views.py @@ -29,7 +29,7 @@ class UserUpdateView(UpdateView): return self.model.objects.filter(id=self.request.user.id) def get_success_url(self): - return reverse('geometry_create') + return reverse('rom_overview')