diff options
author | hardythe1 | 2015-07-08 19:05:51 +0530 |
---|---|---|
committer | hardythe1 | 2015-07-08 19:05:51 +0530 |
commit | ebccb2de90a6886142a4c75980603a48eb481725 (patch) | |
tree | 5e17b44b269b0d6448c3cefe46a9dfdfc52d0a92 | |
parent | d34a650ba5c65217c68451e4eb78b4919a7c7b03 (diff) | |
download | SciPy2015-ebccb2de90a6886142a4c75980603a48eb481725.tar.gz SciPy2015-ebccb2de90a6886142a4c75980603a48eb481725.tar.bz2 SciPy2015-ebccb2de90a6886142a4c75980603a48eb481725.zip |
add login through github, other various UI changes
-rw-r--r-- | website/forms.py | 8 | ||||
-rw-r--r-- | website/static/css/main.css | 24 | ||||
-rw-r--r-- | website/templates/base.html | 2 | ||||
-rw-r--r-- | website/templates/cfp.html | 54 | ||||
-rw-r--r-- | website/templates/user-login.html | 45 | ||||
-rw-r--r-- | website/templates/user-register.html | 5 | ||||
-rw-r--r-- | website/views.py | 34 |
7 files changed, 117 insertions, 55 deletions
diff --git a/website/forms.py b/website/forms.py index da48647..fc828f8 100644 --- a/website/forms.py +++ b/website/forms.py @@ -40,11 +40,3 @@ class UserLoginForm(forms.Form): widget=forms.PasswordInput(attrs={'class': 'form-control', 'placeholder': 'Password'}), label='' ) - def clean(self): - super(UserLoginForm, self).clean() - u_name, pwd = self.cleaned_data["username"],\ - self.cleaned_data["password"] - user = authenticate(username=u_name, password=pwd) - if not user: - raise forms.ValidationError("Invalid username/password") - return user diff --git a/website/static/css/main.css b/website/static/css/main.css index e46e71d..c0331c5 100644 --- a/website/static/css/main.css +++ b/website/static/css/main.css @@ -303,6 +303,13 @@ a:before, a:after { text-align: center;
}
+#login {
+ background: #fff;
+ padding: 60px 0;
+ text-align: center;
+}
+
+
#contact .form {
padding: 30px 0;
}
@@ -372,7 +379,6 @@ a:before, a:after { padding: 25px 0 15px 0;
border-bottom: 1px solid #ddd;
text-align: center;
- height: 15%;
}
#footerwrap span.copyright {
line-height: 40px;
@@ -408,9 +414,6 @@ ul.social-buttons li a:hover, ul.social-buttons li a:focus, ul.social-buttons li .white h1 {
color: #999;
}
-.white p {
- padding-top: 25px;
-}
/* ==========================================================================
Image Mask
@@ -549,3 +552,16 @@ body .header { .row1 input {
width: 350px;
}
+
+.alert {
+ padding: 8px 35px 8px 14px;
+ margin-bottom: 20px;
+ margin-top: 10px;
+ text-shadow: 0 1px 0 rgba(255,255,255,0.5);
+ background-color: #ffca39;
+ color: #3676ab;
+ border: 1px solid transparent;
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+}
diff --git a/website/templates/base.html b/website/templates/base.html index 8d72bde..f2cad0c 100644 --- a/website/templates/base.html +++ b/website/templates/base.html @@ -14,6 +14,7 @@ <title>SciPy India 2015</title> <link href="{% static 'css/bootstrap.css' %}" rel="stylesheet"> + <link href="{% static 'css/bootstrap-social.css' %}" rel="stylesheet"> <!-- Custom CSS --> <link href="{% static 'css/main.css' %}" rel="stylesheet"> @@ -99,6 +100,7 @@ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></div> <div class="col-md-6"> <h3>Python for Scientific Computing</h3> + <br> <p align="justify">SciPy India is a conference providing opportunities to spread the use of the Python programming language in the Scientific Computing community in India. It provides a unique opportunity to interact with the "Who's who" of the Python for Scientific Computing fraternity and learn, understand, participate, and contribute to Scientific Computing using Python. One of the goals of the conference is to combine education, engineering, and science with computing through the medium of Python.</p> </div> </div> diff --git a/website/templates/cfp.html b/website/templates/cfp.html index 22b481e..07d1041 100644 --- a/website/templates/cfp.html +++ b/website/templates/cfp.html @@ -33,20 +33,22 @@ <div class="container"> <div class="row white"> {% if proposal_submit %} - <div class="alert alert-success" role="alert"> - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> - <span aria-hidden="true">×</span> - </button> - <p>Thank You for submitting a talk. Propsal has been saved successfully !</p> - </div> + <center> + <div class="alert" style="width:700px;height:50px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>Thank You for submitting a talk. Propsal has been saved successfully !</p> + </div> + </center> + <div class="clearfix"></div> {% endif %} {% if login_required %} - <div class="alert alert-success" role="alert"> - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> - <span aria-hidden="true">×</span> - </button> - <p>You need to login for submitting a talk !</p> - </div> + <center> + <div class="alert" style="width:400px;height:50px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>Kindly Login/Register to submit a talk !</p> + </div> + </center> + <div class="clearfix"></div> {% endif %} <h2 class="centered">Call for Proposals</h2> <hr> @@ -75,11 +77,31 @@ {% if user and not user.is_anonymous %} <a href="{% url 'website:submitcfp' %}" class="btn btn btn-primary">Submit a Talk</a> {% else %} - To Submit a Talk Login with: - <p><a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}" class="btn btn btn-primary">Google</a> or - <a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}" class="btn btn btn-primary">Facebook</a> or - <a href="{% url 'website:userlogin' %}" class="btn btn btn-primary">Login/SignUp</a> + <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="#">×</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> </div> </div> <!-- row --> diff --git a/website/templates/user-login.html b/website/templates/user-login.html index 0020e34..48b0e04 100644 --- a/website/templates/user-login.html +++ b/website/templates/user-login.html @@ -13,7 +13,7 @@ <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:userregister' %}">Sign Up</a></li> + <li><a href="{% url 'website:cfp' %}">Call for Papers</a></li> </ul> </div> <!--/.nav-collapse --> @@ -23,28 +23,37 @@ {% endblock %} {% block content %} -<div id="contact" name="contact"> +<div id="login" name="login"> <div class="container"> - <div class="row white"> - {% if login_required %} - <div class="alert alert-success" role="alert"> - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> - <span aria-hidden="true">×</span> - </button> - <p>Successfully Registered ! Kindly login to proceed.</p> - </div> + <div class="row"> + <h2 class="centered">Login</h2> + <hr> + {% if invalid %} + <center> + <div class="alert" style="width:300px;height:50px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>Invalid Username/Password</p> + </div> + </center> + <div class="clearfix"></div> {% endif %} - <h2 class="centered">Login</h2> - <hr> <div class="col-md-4"> </div> <div class="col-md-4"> - <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">Sign Up</a> - {% csrf_token %} - </form> + <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> + {% csrf_token %} + </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/user-register.html b/website/templates/user-register.html index 53cf8a6..a561847 100644 --- a/website/templates/user-register.html +++ b/website/templates/user-register.html @@ -13,7 +13,7 @@ <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:userlogin' %}">Login</a></li> + <li><a href="{% url 'website:cfp' %}">Call for Papers</a></li> </ul> </div> <!--/.nav-collapse --> @@ -25,7 +25,7 @@ {% block content %} <div id="contact" name="contact"> <div class="container"> - <div class="row white"> + <div class="row centered"> <h2 class="centered">Sign Up</h2> <hr> <div class="col-md-4"> @@ -34,6 +34,7 @@ <form action="" method="POST"> {{ form.as_p }} <button class="btn btn btn-primary" type="submit">SignUp</button> + <a class="btn btn-primary" href="{% url 'website:cfp' %}">I have an account</a> {% csrf_token %} </form> </div> diff --git a/website/views.py b/website/views.py index 60a7176..3be9034 100644 --- a/website/views.py +++ b/website/views.py @@ -45,14 +45,16 @@ def userlogin(request): context = {} context.update(csrf(request)) if request.method == "POST": - form = UserLoginForm(request.POST) - if form.is_valid(): - user = form.cleaned_data + 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) else: - context['form'] = form + context['invalid'] = True + context['form'] = UserLoginForm return render_to_response('user-login.html', context) else: form = UserLoginForm() @@ -78,9 +80,27 @@ def home(request): def cfp(request): - context = RequestContext(request, {'request': request, - 'user': request.user}) - return render_to_response('cfp.html', + if request.method == "POST": + context = {} + context.update(csrf(request)) + 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) + else: + context['invalid'] = True + context['form'] = UserLoginForm + return render_to_response('cfp.html', context) + else: + form = UserLoginForm() + context = RequestContext(request, {'request': request, + 'user': request.user, + 'form': form}) + context.update(csrf(request)) + return render_to_response('cfp.html', context_instance=context) |