Skip to content

Commit afd5db3

Browse files
Added improvements
1 parent 963bb2c commit afd5db3

8 files changed

Lines changed: 1038 additions & 119 deletions

File tree

oshc/main/static/main/js/pwstrength.js

Lines changed: 863 additions & 0 deletions
Large diffs are not rendered by default.

oshc/main/static/main/js/script.js

Lines changed: 34 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,35 @@
11
$(document).ready(function() {
2-
3-
$("#toTop").click(function() {
4-
$("html, body").animate({
5-
scrollTop: 0
6-
}, 1000);
7-
});
8-
// code for PASSWORD STRENGTH METER
9-
$(".strength-wrapper").css("visibility", "hidden");
10-
$("#password-one").bind("keyup", function() {
11-
if ($(this).val().length === 0) {
12-
$(".strength-wrapper").css("visibility", "hidden");
13-
$("#passwordStrengthString").html("");
14-
} else {
15-
$(".strength-wrapper").css("visibility", "visible");
16-
}
17-
var check = ["[A-Z]", "[a-z]", "[0-9]", "[$@$!%*#?&]"];
18-
var checkCounter = 0;
19-
for (var i = 0; i < check.length; i++) {
20-
if (new RegExp(check[i]).test($(this).val())) {
21-
checkCounter++;
22-
}
23-
}
24-
if (checkCounter > 2 && $(this).val().length > 8) {
25-
checkCounter++;
26-
}
27-
var passwordStrength = "";
28-
switch (checkCounter) {
29-
case 0:
30-
case 1:
31-
passwordStrength = "Weak";
32-
$(".weak").css("background-color", "#E53935");
33-
$('.good, .strong, .verystrong').css({'background-color': '#EEEEEE'});
34-
$("#passwordStrengthString").css("color", "#E53935");
35-
break;
36-
case 2:
37-
case 3:
38-
passwordStrength = "Good";
39-
$('.weak, .good').css({'background-color': '#FFEB3B'});
40-
$('.strong, .verystrong').css({'background-color': '#EEEEEE'});
41-
$("#passwordStrengthString").css("color", "#FFEB3B");
42-
break;
43-
case 4:
44-
passwordStrength = "Strong";
45-
$('.weak, .good, .strong').css({'background-color': '#64DD17'});
46-
$(".verystrong").css("background-color", "#EEEEEE");
47-
$("#passwordStrengthString").css("color", "#64DD17");
48-
break;
49-
case 5:
50-
passwordStrength = "Very Strong";
51-
$('.weak, .good, .strong, .verystrong').css({'background-color': '#2E7D32'});
52-
$("#passwordStrengthString").css("color", "#2E7D32");
53-
break;
54-
}
55-
$("#passwordStrengthString").html(passwordStrength);
56-
});
57-
});
2+
3+
$("#toTop").click(function() {
4+
$("html, body").animate({
5+
scrollTop: 0
6+
}, 1000);
7+
});
8+
// code for Password Strength Meter
9+
jQuery(document).ready(function() {
10+
"use strict";
11+
var options = {};
12+
options.ui = {
13+
container: "#signup_form",
14+
showVerdictsInsideProgressBar: true,
15+
viewports: {
16+
progress: ".pwstrength_viewport_progress",
17+
verdict: ".pwstrength_viewport_verdict"
18+
},
19+
progressBarExtraCssClasses: "progress-bar-striped active"
20+
};
21+
options.common = {
22+
debug: true,
23+
zxcvbn: true,
24+
zxcvbnTerms: ['samurai', 'shogun', 'bushido', 'daisho', 'seppuku'],
25+
userInputs: ['#id_username', '#id_email']
26+
};
27+
options.rules = {
28+
activated: {
29+
wordTwoCharacterClasses: true,
30+
wordRepetitions: true
31+
}
32+
};
33+
$('#id_password1').pwstrength(options);
34+
});
35+
});

oshc/main/static/main/js/zxcvbn.js

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

oshc/main/templates/account/login.html

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,41 @@
66
{% block head_title %}{% trans "Sign In" %}{% endblock %}
77

88
{% block content %}
9-
10-
<h1>{% trans "Sign In" %}</h1>
11-
12-
{% get_providers as socialaccount_providers %}
13-
14-
{% if socialaccount_providers %}
15-
<p>{% blocktrans with site.name as site_name %}Please sign in with one
16-
of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
17-
for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>
18-
19-
<div class="socialaccount_ballot">
20-
21-
<ul class="socialaccount_providers">
22-
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
23-
</ul>
24-
25-
<div class="login-or">{% trans 'or' %}</div>
26-
27-
</div>
28-
29-
{% include "socialaccount/snippets/login_extra.html" %}
30-
31-
{% else %}
32-
<p>{% blocktrans %}If you have not created an account yet, then please
33-
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
34-
{% endif %}
35-
36-
<form class="login" method="POST" action="{% url 'account_login' %}">
37-
{% csrf_token %}
38-
{{ form.as_p }}
39-
{% if redirect_field_value %}
40-
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
9+
<section class="main-section">
10+
<h1>{% trans "Sign In" %}</h1>
11+
12+
{% get_providers as socialaccount_providers %}
13+
14+
{% if socialaccount_providers %}
15+
<p>{% blocktrans with site.name as site_name %}Please sign in with one
16+
of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
17+
for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>
18+
19+
<div class="socialaccount_ballot">
20+
21+
<ul class="socialaccount_providers">
22+
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
23+
</ul>
24+
25+
<div class="login-or">{% trans 'or' %}</div>
26+
27+
</div>
28+
29+
{% include "socialaccount/snippets/login_extra.html" %}
30+
31+
{% else %}
32+
<p>{% blocktrans %}If you have not created an account yet, then please
33+
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
4134
{% endif %}
42-
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
43-
<button class="primaryAction" type="submit">{% trans "Sign In" %}</button>
44-
</form>
45-
35+
36+
<form class="login" method="POST" action="{% url 'account_login' %}">
37+
{% csrf_token %}
38+
{{ form.as_p }}
39+
{% if redirect_field_value %}
40+
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
41+
{% endif %}
42+
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
43+
<button class="primaryAction" type="submit">{% trans "Sign In" %}</button>
44+
</form>
45+
</section>
4646
{% endblock %}
Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,68 @@
11
{% extends "account/base.html" %}
2-
32
{% load i18n %}
4-
53
{% block head_title %}{% trans "Signup" %}{% endblock %}
6-
74
{% block content %}
8-
<h1>{% trans "Sign Up" %}</h1>
9-
10-
<p>{% blocktrans %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktrans %}</p>
11-
12-
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
13-
{% csrf_token %}
14-
{{ form.as_p }}
15-
{% if redirect_field_value %}
16-
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
17-
{% endif %}
18-
<button type="submit">{% trans "Sign Up" %} &raquo;</button>
19-
</form>
20-
5+
<section class="main-section">
6+
<div class="container">
7+
<div class="row">
8+
<div class="col-sm-6 col-md-4 col-md-offset-4">
9+
<h1 class="form-title text-center">{% trans 'Sign Up Here' %}</h1>
10+
<ul class="errorlist"></li></ul>
11+
<div class="account-wall">
12+
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
13+
{% csrf_token %}
14+
<div class="form-registration">
15+
<p class="required field-title">
16+
{% if form.username.errors %}
17+
{% for error in form.username.errors %}
18+
<div style="font-size: 12px;" class="alert alert-danger alert-dismissible" role="alert">
19+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
20+
{{ error|escape }}</div>
21+
{% endfor %}
22+
{% endif %}
23+
<label class="required" for="id_username">{% trans 'Username:' %}</label>
24+
<input class="form-control" type="text" name="username" placeholder="Username" autofocus="autofocus" minlength="1" maxlength="150" required id="id_username" />
25+
<span class="helptext">{% trans 'Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.' %}</span>
26+
</p>
27+
<p>
28+
{% if form.email.errors %}
29+
{% for error in form.email.errors %}
30+
<div style="font-size: 12px;" class="alert alert-danger alert-dismissible" role="alert">
31+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
32+
{{ error|escape }}</div>
33+
{% endfor %}
34+
{% endif %}
35+
<label class="required" for="id_email">{% trans 'E-mail:' %}</label>
36+
<input class="form-control" type="email" name="email" placeholder="E-mail address" id="id_email" />
37+
</p>
38+
<p>
39+
{% if form.password.errors %}
40+
{% for error in form.password.errors %}
41+
<div class="alert alert-danger" role="alert">{{ error|escape }}</div>
42+
{% endfor %}
43+
{% endif %}
44+
<label class="required" for="id_password1">{% trans 'Password:' %}</label>
45+
<input class="form-control" type="password" name="password1" placeholder="Password" required id="id_password1" />
46+
</p>
47+
<div class="pwstrength_viewport_progress"></div>
48+
<p>
49+
{% if form.password.errors %}
50+
{% for error in form.password.errors %}
51+
<div class="alert alert-danger" role="alert">{{ error|escape }}</div>
52+
{% endfor %}
53+
{% endif %}
54+
<label class="required" for="id_password2">{% trans 'Password (again):' %}</label>
55+
<input class="form-control" type="password" name="password2" placeholder="Password (again)" required id="id_password2" />
56+
<span class="helptext">{% trans 'Enter the same password as before, for verification.' %}</span>
57+
</p>
58+
<button class="btn btn-lg btn-primary btn-block" type="submit">{% trans "Sign Up" %} &raquo;</button>
59+
</div>
60+
</form>
61+
</div>
62+
<br>
63+
<p class="text-center">{% blocktrans %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktrans %}</p>
64+
</div>
65+
</div>
66+
</div>
67+
</section>
2168
{% endblock %}

oshc/main/templates/base.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
9393
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
9494
<script src="{% static "main/js/script.js" %}"></script>
95+
<script src="{% static "main/js/pwstrength.js" %}"></script>
96+
<script src="{% static "main/js/zxcvbn.js" %}"></script>
9597
</body>
9698

9799
</html>

oshc/main/templates/profile.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{% block head_title %}{% trans "Profile" %}{% endblock %}
66

77
{% block content %}
8-
<h1>{% trans "Welcome to Open Source Help Community" %}</h1>
9-
8+
<section class="main-section">
9+
<h1>{% trans "Welcome to Open Source Help Community" %}</h1>
10+
</section>
1011
{% endblock %}

oshc/oshc/settings.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
ALLOWED_HOSTS = ['*']
2727

2828
# Tuple of people who get error notifications
29-
# ADMINS = [
30-
# ('Tapasweni Pathak', 'tapaswenipathak@gmail.com'),
31-
# ('Nikhita Raghunath', 'nikitaraghunath@gmail.com'),
32-
# ('Ibrahim Jarif', 'jarifibrahim@gmail.com'),
33-
# ('Amar Prakash Pandey', 'amar.om1994@gmail.com')
34-
# ]
29+
ADMINS = [
30+
('Tapasweni Pathak', 'tapaswenipathak@gmail.com'),
31+
('Nikhita Raghunath', 'nikitaraghunath@gmail.com'),
32+
('Ibrahim Jarif', 'jarifibrahim@gmail.com'),
33+
('Amar Prakash Pandey', 'amar.om1994@gmail.com')
34+
]
3535

3636
# Application definition
3737

@@ -81,10 +81,10 @@
8181
]
8282

8383
AUTHENTICATION_BACKENDS = (
84+
# User can login from both username or email address
8485
'authentication.regbackend.EmailLoginBackend',
8586
# Needed to login by username in Django admin, regardless of `allauth`
8687
'django.contrib.auth.backends.ModelBackend',
87-
8888
# `allauth` specific authentication methods, such as login by e-mail
8989
'allauth.account.auth_backends.AuthenticationBackend',
9090
)
@@ -155,7 +155,7 @@
155155

156156
EMAIL_HOST = 'smtp.gmail.com'
157157
EMAIL_HOST_USER = 'vaibhav.singh.14cse@bml.edu.in'
158-
EMAIL_HOST_PASSWORD = 'Gorakhpur#1997'
158+
EMAIL_HOST_PASSWORD = 'password'
159159
EMAIL_PORT = 587
160160
EMAIL_USE_TLS = True
161-
LOGIN_REDIRECT_URL = "profile/"
161+
LOGIN_REDIRECT_URL = "/"

0 commit comments

Comments
 (0)