summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--website/static/css/main.css12
-rw-r--r--website/templates/cfp.html163
-rw-r--r--website/templates/forgot-password.html (renamed from website/templates/user-login.html)27
-rw-r--r--website/templates/update-password.html51
-rw-r--r--website/templates/user-register.html12
-rw-r--r--website/urls.py2
-rw-r--r--website/views.py91
7 files changed, 273 insertions, 85 deletions
diff --git a/website/static/css/main.css b/website/static/css/main.css
index 7cb6991..c28a222 100644
--- a/website/static/css/main.css
+++ b/website/static/css/main.css
@@ -375,7 +375,6 @@ a:before, a:after {
margin-right: 4px;
}
#footerwrap {
- background: #2b2b2b;
padding: 25px 0 15px 0;
border-bottom: 1px solid #ddd;
text-align: center;
@@ -585,3 +584,14 @@ body .header {
list-style-type: none;
color: red;
}
+
+.pwd-recovery-email {
+ height: 45px;
+ width: 350px;
+ margin-right: 5px;
+ border-radius: 4px;
+}
+
+.pwd-recovery-btn {
+ height:45px;
+}
diff --git a/website/templates/cfp.html b/website/templates/cfp.html
index 07d1041..8eab2c1 100644
--- a/website/templates/cfp.html
+++ b/website/templates/cfp.html
@@ -41,6 +41,15 @@
</center>
<div class="clearfix"></div>
{% endif %}
+ {% if for_update_password %}
+ <center>
+ <div class="alert" style="width:350px;height:45px;">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ <p>Kindly login to update your password</p>
+ </div>
+ </center>
+ <div class="clearfix"></div>
+ {% endif %}
{% if login_required %}
<center>
<div class="alert" style="width:400px;height:50px;">
@@ -50,62 +59,114 @@
</center>
<div class="clearfix"></div>
{% endif %}
+ {% if password_updated %}
+ <center>
+ <div class="alert" style="width:400px;height:50px;">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ <p>Password has been updated successfully !</p>
+ </div>
+ </center>
+ <div class="clearfix"></div>
+ {% endif %}
+ {% if password_reset %}
+ <center>
+ <div class="alert" style="width:600px;height:80px;">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ <p>New login details have been sent to your email address. Kindly check your mail box. Do not forget to check your spam folder.</p>
+ </div>
+ </center>
+ <div class="clearfix"></div>
+ {% endif %}
<h2 class="centered">Call for Proposals</h2>
<hr>
- <div class="col-md-6">
- <p align="justify">We look forward to your proposals. Conference aims to promote <strong>Python for Scientific Computing and Education</strong>. Topics like pedagogy, exploration, modeling or from both applied and developmental perspectives are welcome. Contributions from academia as well as industry are welcome. If you wish to propose a talk at the conference, kindly follow the guidelines given below.</p>
- <hr>
- <h3><u>Proposal Guidelines</u></h3>
- <ul>
- <li>Submit a proposal through <a href="#">this link</a>
- <li>The project you are willing to present should be an actual implementation rather than just an idea.
- <li>Abstract should be of 300 to 700 words describing the topic, including its relevance to scientific computing.
- <li>Proposals with an aim to promote a commercial product or service will be rejected.
- <li>In your abstract mention about various tools/libraries used for development.
- <li>Notification for selection/rejection of your proposal will be given through email.
- <li>All selected proposals must be presented at the conference by at least one author.
- </ul>
- </div>
- <div class="col-md-6">
- <h3><u>Important Dates</u></h3>
- <ul>
- <li>CFP Open: July 5, 2015
- <li>CFP Close: October 15, 2015
- <li>Announcement of selected proposals: November 15, 2015
- </ul>
- <hr>
- {% if user and not user.is_anonymous %}
- <a href="{% url 'website:submitcfp' %}" class="btn btn btn-primary">Submit a Talk</a>
- {% else %}
- <p>Login/Register to submit a talk
- {% if invalid %}
- <center>
- <div class="alert" style="width:300px;height:45px;">
- <a class="close" data-dismiss="alert" href="#">&times;</a>
- <p>Invalid Username/Password</p>
- </div>
- </center>
- <div class="clearfix"></div>
- {% endif %}
- <div class="col-md-8">
- <form action="" method="POST">
- {{ form.as_p }}
- <button class="btn btn btn-primary" type="submit">Login</button>
- <a href="{% url 'website:userregister' %}" class="btn btn btn-primary">Create an Account</a>
- {% csrf_token %}
- </form>
-
- <br>
- <p>OR</p>
- <a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}" class="btn btn-block btn-social btn-google"><i class="fa fa-google"></i> Sign in with Google</a>
- <a href="{% url 'social:begin' 'github' %}?next={{ request.path }}" class="btn btn-block btn-social btn-github"><i class="fa fa-github"></i> Sign in with Github</a>
- <a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}" class="btn btn-block btn-social btn-facebook"><i class="fa fa-facebook"></i> Sign in with Facebook</a>
- {% endif %}
+ <div class="col-md-6">
+ <p align="justify">We look forward to your proposals. Conference aims to promote <strong>Python for Scientific Computing and Education</strong>. Topics like pedagogy, exploration, modeling or from both applied and developmental perspectives are welcome. Contributions from academia as well as industry are welcome. If you wish to propose a talk at the conference, kindly follow the guidelines given below.</p>
+ <hr>
+ <h3><u>Proposal Guidelines</u></h3>
+ <ul>
+ <li>Submit a proposal through <a href="#">this link</a>
+ <li>The project you are willing to present should be an actual implementation rather than just an idea.
+ <li>Abstract should be of 300 to 700 words describing the topic, including its relevance to scientific computing.
+ <li>Proposals with an aim to promote a commercial product or service will be rejected.
+ <li>In your abstract mention about various tools/libraries used for development.
+ <li>Notification for selection/rejection of your proposal will be given through email.
+ <li>All selected proposals must be presented at the conference by at least one author.
+ </ul>
+ </div>
+ <div class="col-md-6">
+ <h3><u>Important Dates</u></h3>
+ <ul>
+ <li>CFP Open: July 5, 2015
+ <li>CFP Close: October 15, 2015
+ <li>Announcement of selected proposals: November 15, 2015
+ </ul>
+ <hr>
+ {% if user and not user.is_anonymous %}
+ <a href="{% url 'website:submitcfp' %}" class="btn btn btn-primary">Submit a Talk</a>
+ {% else %}
+ <p>Login/Register to submit a talk
+ {% if invalid %}
+ <center>
+ <div class="alert" style="width:300px;height:45px;">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ <p>Invalid Username/Password</p>
+ </div>
+ </center>
+ <div class="clearfix"></div>
+ {% endif %}
+ {% if for_update_password or password_reset %}
+ <div class="col-md-8">
+ <center>
+ <div class="alert" style="width:300px;height:60px;">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ <p style="line-height:20px;">Login with the details sent to you to update your password.</p>
+ </div>
+ </center>
+ <div class="clearfix"></div>
+ <form action="/2015/cfp/?next=/2015/accounts/update-password" method="POST">
+ {{ form.as_p }}
+ <button class="btn btn btn-primary" type="submit">Login</button>
+ <a href="{% url 'website:userregister' %}" class="btn btn btn-primary">Create an Account</a>
+ <a href="{% url 'website:forgotpassword' %}">Forgot Password ?</a>
+ {% csrf_token %}
+ </form>
+ </div>
+ {% elif password_updated %}
+ <div class="col-md-8">
+ <form action="/2015/cfp/" method="POST">
+ {{ form.as_p }}
+ <button class="btn btn btn-primary" type="submit">Login</button>
+ <a href="{% url 'website:userregister' %}" class="btn btn btn-primary">Create an Account</a>
+ <a href="{% url 'website:forgotpassword' %}">Forgot Password ?</a>
+ {% csrf_token %}
+ </form>
+ <br>
+ <p>OR</p>
+ <a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}" class="btn btn-block btn-social btn-google"><i class="fa fa-google"></i> Sign in with Google</a>
+ <a href="{% url 'social:begin' 'github' %}?next={{ request.path }}" class="btn btn-block btn-social btn-github"><i class="fa fa-github"></i> Sign in with Github</a>
+ <a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}" class="btn btn-block btn-social btn-facebook"><i class="fa fa-facebook"></i> Sign in with Facebook</a>
+ </div>
+ {% else %}
+ <div class="col-md-8">
+ <form action="" method="POST">
+ {{ form.as_p }}
+ <button class="btn btn btn-primary" type="submit">Login</button>
+ <a href="{% url 'website:userregister' %}" class="btn btn btn-primary">Create an Account</a>
+ <a href="{% url 'website:forgotpassword' %}">Forgot Password ?</a>
+ {% csrf_token %}
+ </form>
+ <br>
+ <p>OR</p>
+ <a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}" class="btn btn-block btn-social btn-google"><i class="fa fa-google"></i> Sign in with Google</a>
+ <a href="{% url 'social:begin' 'github' %}?next={{ request.path }}" class="btn btn-block btn-social btn-github"><i class="fa fa-github"></i> Sign in with Github</a>
+ <a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}" class="btn btn-block btn-social btn-facebook"><i class="fa fa-facebook"></i> Sign in with Facebook</a>
+ {% endif %}
+ </div>
+ {% endif %}
</div>
- </div>
</div>
<!-- row -->
</div>
</div>
-
+<hr>
{% endblock %}
diff --git a/website/templates/user-login.html b/website/templates/forgot-password.html
index 48b0e04..c96f491 100644
--- a/website/templates/user-login.html
+++ b/website/templates/forgot-password.html
@@ -26,34 +26,25 @@
<div id="login" name="login">
<div class="container">
<div class="row">
- <h2 class="centered">Login</h2>
+ <h2 class="centered">Password Recovery</h2>
<hr>
- {% if invalid %}
+ {% if invalid_email %}
<center>
<div class="alert" style="width:300px;height:50px;">
<a class="close" data-dismiss="alert" href="#">&times;</a>
- <p>Invalid Username/Password</p>
+ <p>Invalid Email address</p>
</div>
</center>
<div class="clearfix"></div>
{% endif %}
- <div class="col-md-4">
- </div>
- <div class="col-md-4">
- <p>Login with your SciPy India Account
- <form action="" method="POST">
- {{ form.as_p }}
- <button class="btn btn btn-primary" type="submit">Login</button>
- <a href="{% url 'website:userregister' %}" class="btn btn btn-primary">Create an Account</a>
+ <div class="col-md-12">
+ <p style="line-height:10px;">Enter the Email address you used while registration.</p>
+ <p style="line-height:10px;">We will send you the updated login details on your Email address.</p>
+ <form action="" method=POST enctype="multipart/form-data">
{% csrf_token %}
+ <p><input class="pwd-recovery-email" type=text id="email" name="email" placeholder="Your Email">
+ <p><input class="btn btn-primary pwd-recovery-btn" type=submit value="Reset Password">
</form>
- <hr>
- <center>
- <p>OR</p>
- <a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}" class="btn btn-block btn-social btn-google"><i class="fa fa-google"></i> Sign in with Google</a>
- <a href="{% url 'social:begin' 'github' %}?next={{ request.path }}" class="btn btn-block btn-social btn-github"><i class="fa fa-github"></i> Sign in with Github</a>
- <a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}" class="btn btn-block btn-social btn-facebook"><i class="fa fa-facebook"></i> Sign in with Facebook</a>
- </center>
</div>
</div>
</div>
diff --git a/website/templates/update-password.html b/website/templates/update-password.html
new file mode 100644
index 0000000..dc02b23
--- /dev/null
+++ b/website/templates/update-password.html
@@ -0,0 +1,51 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block navbar %}
+<div id="navbar-main">
+ <!-- Fixed navbar -->
+ <div class="navbar navbar-inverse navbar-fixed-top">
+ <div class="container">
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
+ <a class="navbar-brand" href="{% url 'website:home' %}">SciPy India 2015 </a>
+ </div>
+ <div class="navbar-collapse collapse">
+ <ul class="nav navbar-nav navbar-right">
+ <li><a href="{% url 'website:home' %}">Home</a></li>
+ <li><a href="{% url 'website:cfp' %}">Call for Papers</a></li>
+ </ul>
+ </div>
+ <!--/.nav-collapse -->
+ </div>
+ </div>
+</div>
+{% endblock %}
+
+{% block content %}
+<div id="login" name="login">
+ <div class="container">
+ <div class="row">
+ <h2 class="centered">Update Password</h2>
+ <hr>
+ {% if no_match %}
+ <center>
+ <div class="alert" style="width:400px;height:50px;">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ <p>Password & Confirm Password did not match</p>
+ </div>
+ </center>
+ <div class="clearfix"></div>
+ {% endif %}
+ <div class="col-md-12">
+ <form action="" method=POST enctype="multipart/form-data">
+ {% csrf_token %}
+ <p><input class="pwd-recovery-email" type=password id="new_password" name="new_password" placeholder="New Password">
+ <p><input class="pwd-recovery-email" type=password id="confirm_new_password" name="confirm_new_password" placeholder="Confirm New Password">
+ <p><input class="btn btn-primary pwd-recovery-btn" type=submit value="Update Password">
+ </form>
+ </div>
+ </div>
+ </div>
+</div>
+{% endblock %}
diff --git a/website/templates/user-register.html b/website/templates/user-register.html
index 606c780..c09c08b 100644
--- a/website/templates/user-register.html
+++ b/website/templates/user-register.html
@@ -27,6 +27,18 @@
<div class="container">
<div class="row centered">
<h2 class="centered">Sign Up</h2>
+ {% if email_registered %}
+ <center>
+ <div class="alert" style="width:300px;height:50px;">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ <p>Email ID is already registered !</p>
+ </div>
+ <p style="line-height:5px;">Have you already logged in using social logins ?</p>
+ <p style="line-height:5px;">or</p>
+ <p style="line-height:5px;"><a href="#">Click Here</a> if you forgot your username or password</p>
+ </center>
+ <div class="clearfix"></div>
+ {% endif %}
<hr>
<div class="col-md-3">
</div>
diff --git a/website/urls.py b/website/urls.py
index 324befe..0a4bc56 100644
--- a/website/urls.py
+++ b/website/urls.py
@@ -7,4 +7,6 @@ urlpatterns = patterns('',
url(r'^submit-cfp/$', 'website.views.submitcfp', name='submitcfp'),
url(r'^accounts/register/$', 'website.views.userregister', name='userregister'),
url(r'^accounts/login/$', 'website.views.userlogin', name='userlogin'),
+ url(r'^accounts/forgot-password/$', 'website.views.forgotpassword', name='forgotpassword'),
+ url(r'^accounts/update-password/$', 'website.views.updatepassword', name='updatepassword'),
)
diff --git a/website/views.py b/website/views.py
index fdf019b..b32f99a 100644
--- a/website/views.py
+++ b/website/views.py
@@ -16,17 +16,30 @@ from django.core.mail import send_mail
from website.forms import ProposalForm, UserRegisterForm, UserLoginForm
from website.models import Proposal, Comments
from social.apps.django_app.default.models import UserSocialAuth
+import random
+import string
def userregister(request):
context = {}
context.update(csrf(request))
+ registered_emails = []
+ users = User.objects.all()
+ for user in users:
+ registered_emails.append(user.email)
if request.user.is_anonymous():
if request.method == 'POST':
form = UserRegisterForm(request.POST)
if form.is_valid():
- form.save()
- return HttpResponseRedirect('/2015/cfp')
+ data = form.cleaned_data
+ if data['email'] in registered_emails:
+ context['form'] = form
+ context['email_registered'] = True
+ return render_to_response('user-register.html', context)
+ else:
+ form.save()
+ context['registration_complete'] = True
+ return render_to_response('cfp.html', context)
else:
context.update(csrf(request))
context['form'] = form
@@ -41,25 +54,70 @@ def userregister(request):
return HttpResponseRedirect('/2015/cfp')
-def userlogin(request):
+def forgotpassword(request):
context = {}
+ user_emails = []
context.update(csrf(request))
- if request.method == "POST":
- username = request.POST['username']
- password = request.POST['password']
- user = authenticate(username=username, password=password)
- if user is not None:
- login(request, user)
- context['user'] = user
- return render_to_response('cfp.html', context)
+ if request.method == 'POST':
+ users = User.objects.all()
+ for user in users:
+ user_emails.append(user.email)
+ email = request.POST['email']
+ if email == "":
+ context['invalid_email'] = True
+ return render_to_response("forgot-password.html", context)
+ if email in user_emails:
+ user = User.objects.get(email=email)
+ password = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(8))
+ user.set_password(password)
+ user.save()
+ sender_name = "SciPy India 2015"
+ sender_email = "scipy@fossee.in"
+ subject = "SciPy India - Password Reset"
+ to = (user.email, )
+ message = """Dear """+user.first_name+""",\nYour password for SciPy India 2015 been reset. Your credentials are:\nUsername: """+user.username+"""\nPassword: """+password+"""\n\nWe recommend you to login with the given credentials & update your password immediately.\nLink to set new password: http://scipy.in/2015/update-password\n\nThank You !\n\nRegards,\n SciPy India,\nFOSSEE - IIT Bombay."""
+ send_mail(subject, message, sender_email, to)
+ form = UserLoginForm()
+ context['form'] = form
+ context['password_reset'] = True
+ return render_to_response("cfp.html", context)
else:
- context['invalid'] = True
- context['form'] = UserLoginForm
- return render_to_response('user-login.html', context)
+ context['invalid_email'] = True
+ return render_to_response("forgot-password.html", context)
+ else:
+ return render_to_response('forgot-password.html', context)
+
+
+def updatepassword(request):
+ context = {}
+ user = request.user
+ context.update(csrf(request))
+ if user.is_authenticated():
+ if request.method == 'POST':
+ new_password = request.POST['new_password']
+ confirm = request.POST['confirm_new_password']
+ if new_password == "" or confirm == "":
+ context['empty'] = True
+ return render_to_response("update-password.html", context)
+ if new_password == confirm:
+ user.set_password(new_password)
+ user.save()
+ context['password_updated'] = True
+ logout(request)
+ form = UserLoginForm()
+ context['form'] = form
+ return render_to_response("cfp.html", context)
+ else:
+ context['no_match'] = True
+ return render_to_response("update-password.html", context)
+ else:
+ return render_to_response("update-password.html", context)
else:
form = UserLoginForm()
context['form'] = form
- return render_to_response('user-login.html', context)
+ context['for_update_password'] = True
+ return render_to_response('cfp.html', context)
+
def home(request):
@@ -88,6 +146,9 @@ def cfp(request):
user = authenticate(username=username, password=password)
if user is not None:
login(request, user)
+ if 'next' in request.GET:
+ next = request.GET['next']
+ return HttpResponseRedirect(next)
context['user'] = user
return render_to_response('cfp.html', context)
else: