Added account creation confirmation #25
authordurandn
Thu, 20 Oct 2016 15:15:44 +0200
changeset 230 9c9abc933135
parent 229 320c307a57ec
child 231 b7c007c10abe
Added account creation confirmation #25
src/iconolab/auth/urls.py
src/iconolab/auth/views.py
src/iconolab/templates/registration/created.html
--- a/src/iconolab/auth/urls.py	Thu Oct 20 12:49:15 2016 +0200
+++ b/src/iconolab/auth/urls.py	Thu Oct 20 15:15:44 2016 +0200
@@ -6,6 +6,7 @@
 
 urlpatterns = [
     url(r'^register/$', views.RegisterView.as_view(), name='register'),
+    url(r'^register/created/$', views.UserCreatedView.as_view(), name='user_created'),
     url(r'^login/$', views.LoginView.as_view(), name='login'),
     url(r'^password/reset$', password_change, name='password_reset'),
  	url(r'^logout/', views.LogoutView.as_view(), name='logout'),
--- a/src/iconolab/auth/views.py	Thu Oct 20 12:49:15 2016 +0200
+++ b/src/iconolab/auth/views.py	Thu Oct 20 15:15:44 2016 +0200
@@ -5,7 +5,7 @@
 from django.core.urlresolvers import reverse_lazy
 from django.contrib.auth.forms import AuthenticationForm
 from django.views.generic import FormView
-from django.views.generic.base import RedirectView
+from django.views.generic.base import RedirectView, TemplateView
 from django.views.generic.edit import CreateView
 
 User = get_user_model()
@@ -55,7 +55,7 @@
 	model = User 
 	template_name = 'registration/register.html'
 	form_class = UserCreationForm
-	success_url = reverse_lazy("home")
+	success_url = reverse_lazy("account:user_created")
 	
 	def post(self, request, *args, **kwargs):
 		self.object = None
@@ -66,4 +66,7 @@
 			login(request, user)
 			return HttpResponseRedirect(self.success_url)
 		else:
-			return self.form_invalid(form)
\ No newline at end of file
+			return self.form_invalid(form)
+
+class UserCreatedView(TemplateView):
+	template_name='registration/created.html'
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/iconolab/templates/registration/created.html	Thu Oct 20 15:15:44 2016 +0200
@@ -0,0 +1,25 @@
+{% extends "iconolab_base.html" %}
+
+{% block content %}
+
+{% if form.errors %}
+<p>Your username and password didn't match. Please try again.</p>
+{% endif %}
+
+<div class='col-md-12 text-center'>
+    <h2>Votre compte a été créé! <small>Bienvenue sur Iconolab</small></h2><br>
+    <ul class="list-inline">
+      <li>
+        <a class="btn btn-default" href="{% url 'user_home' user.id %}">
+          <span class="glyphicon glyphicon-user" aria-hidden="true"></span>  
+          Ma page de profil
+        </a>
+      </li>
+      <li><a class="btn btn-default" href="{% url 'home' %}">
+          <span class="glyphicon glyphicon-home" aria-hidden="true"></span>  
+          Page d'accueil d'Iconolab
+        </a></li>
+    </ul>
+</div>
+
+{% endblock %}
\ No newline at end of file