From ebccb2de90a6886142a4c75980603a48eb481725 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Wed, 8 Jul 2015 19:05:51 +0530 Subject: add login through github, other various UI changes --- website/forms.py | 8 ------ website/static/css/main.css | 24 +++++++++++++--- website/templates/base.html | 2 ++ website/templates/cfp.html | 54 +++++++++++++++++++++++++----------- website/templates/user-login.html | 45 ++++++++++++++++++------------ website/templates/user-register.html | 5 ++-- 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 @@ SciPy India 2015 + @@ -99,6 +100,7 @@

Python for Scientific Computing

+

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.

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 @@
{% if proposal_submit %} - +
+
+ × +

Thank You for submitting a talk. Propsal has been saved successfully !

+
+
+
{% endif %} {% if login_required %} - +
+
+ × +

Kindly Login/Register to submit a talk !

+
+
+
{% endif %}

Call for Proposals


@@ -75,11 +77,31 @@ {% if user and not user.is_anonymous %} Submit a Talk {% else %} - To Submit a Talk Login with: -

Google or - Facebook or - Login/SignUp +

Login/Register to submit a talk + {% if invalid %} +

+
+ × +

Invalid Username/Password

+
+
+
+ {% endif %} +
+
+ {{ form.as_p }} + + Create an Account + {% csrf_token %} +
+ +
+

OR

+ Sign in with Google + Sign in with Github + Sign in with Facebook {% endif %} +
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 @@ @@ -23,28 +23,37 @@ {% endblock %} {% block content %} -
+
-
- {% if login_required %} - +
+

Login

+
+ {% if invalid %} +
+
+ × +

Invalid Username/Password

+
+
+
{% endif %} -

Login

-
-
- {{ form.as_p }} - - Sign Up - {% csrf_token %} -
+

Login with your SciPy India Account +

+ {{ form.as_p }} + + Create an Account + {% csrf_token %} +
+
+
+

OR

+ Sign in with Google + Sign in with Github + Sign in with Facebook +
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 @@ @@ -25,7 +25,7 @@ {% block content %}
-
+

Sign Up


@@ -34,6 +34,7 @@
{{ form.as_p }} + I have an account {% csrf_token %}
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) -- cgit