fixed a bug in registration .
authornishanth
Fri, 09 Apr 2010 15:48:47 +0530
changeset 7 af9ab5ad2786
parent 6 057498d12450
child 8 e2699e042129
fixed a bug in registration .
account_created.html
base.html
reg/events.py
reg/forms.py
register.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/account_created.html	Fri Apr 09 15:48:47 2010 +0530
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+{% block content %}
+The account has been created.<br />
+<a href="/reg/login">click here</a> to go to login page.
+{% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base.html	Fri Apr 09 15:48:47 2010 +0530
@@ -0,0 +1,12 @@
+<html>
+<head>
+<title>
+{% block title %}
+Workshop App
+{% endblock %}
+</title></head>
+<body>
+{% block content %}
+{% endblock %}
+</body>
+</html>
--- a/reg/events.py	Fri Apr 09 15:35:40 2010 +0530
+++ b/reg/events.py	Fri Apr 09 15:48:47 2010 +0530
@@ -57,7 +57,12 @@
             return new_event
         except IntegrityError:
             pass
-'''
-def mail_user(email):
-    """ get the user 
-'''
+
+
+def activate_user(user):
+    """ mark the is_active flag as true.
+    """
+
+    user.is_active = True
+    user.save()
+    return user
--- a/reg/forms.py	Fri Apr 09 15:35:40 2010 +0530
+++ b/reg/forms.py	Fri Apr 09 15:48:47 2010 +0530
@@ -1,8 +1,7 @@
 import string
 
+from django import forms
 from django.contrib.auth.models import User
-from django import forms
-
 from django.contrib.auth import authenticate
 
 from workshop.reg.models import Profile
@@ -47,6 +46,9 @@
         fields = ['email', 'password', 'confirm_password', 'first_name', 'last_name', 'gender', 'profession', 'affiliated_to', 'interests']
 
     def clean_email(self):
+        """ check if a user exists with same email.
+        """
+
         email = self.cleaned_data['email']
         try:
             User.objects.get(email__iexact=email)
@@ -56,6 +58,11 @@
             return email
 
     def clean_password(self):
+        """ check if the password contains only alphabets or digits or punctuation.
+        then check if the size of the password is optimal.
+        then check if both the given passwords match.
+        """
+
         password = self.cleaned_data['password']
 
         if password.strip(string.ascii_letters+string.punctuation+string.digits):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/register.html	Fri Apr 09 15:48:47 2010 +0530
@@ -0,0 +1,7 @@
+{% extends "base.html" %}
+{% block content %}
+<form action="" method="post">
+{{ form.as_p }}
+<input type="submit" value="submit">
+</form>
+{% endblock %}