Skip to content

Commit 508e048

Browse files
authoredAug 5, 2018
Reset password (#60)
* updated travis yml file * removed xml files * passsword reset issue fixed, updated html design with django-crm theme, added named urls in templates * updated readme.rst file
1 parent ecc3e88 commit 508e048

18 files changed

+95
-72
lines changed
 

‎README.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ Django-CRM
44
Django CRM is opensourse CRM developed on django framework. It has all the basic features of CRM to start with. We welcome code contributions and feature requests via github.
55

66

7-
.. image:: https://coveralls.io/repos/github/MicroPyramid/Django-CRM/badge.svg?branch=master
8-
:target: https://coveralls.io/github/MicroPyramid/Django-CRM?branch=master
9-
107
.. image:: https://landscape.io/github/MicroPyramid/Django-CRM/master/landscape.svg?style=flat
118
:target: https://landscape.io/github/MicroPyramid/Django-CRM/master
129
:alt: Code Health
@@ -23,10 +20,19 @@ Django CRM is opensourse CRM developed on django framework. It has all the basic
2320
- Codacy
2421
- Support
2522
* - .. image:: https://travis-ci.org/MicroPyramid/Django-CRM.svg?branch=master
23+
:target: https://travis-ci.org/MicroPyramid/Django-CRM
2624
- .. image:: https://api.codacy.com/project/badge/Grade/b11da5f09dd542479fd3bd53944595d2
25+
:target: https://app.codacy.com/project/ashwin/Django-CRM/dashboard
26+
:alt: Codacy Dashboard
2727
.. image:: https://api.codacy.com/project/badge/Coverage/b11da5f09dd542479fd3bd53944595d2
28+
:target: https://app.codacy.com/project/ashwin/Django-CRM/dashboard
29+
:alt: Codacy Coverage
2830
- .. image:: https://badges.gitter.im/Micropyramid/Django-CRM.png
31+
:target: https://gitter.im/MicroPyramid/Django-CRM
32+
:alt: Gitter
2933
.. image:: https://www.codetriage.com/micropyramid/django-crm/badges/users.svg
34+
:target: https://www.codetriage.com/micropyramid/django-crm
35+
:alt: Code Helpers
3036

3137

3238
http://django-crm.readthedocs.io for latest documentation

‎common/urls.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
path('login/', LoginView.as_view(), name='login'),
1717
path('forgot-password/', ForgotPasswordView.as_view(), name='forgot_password'),
1818
path('logout/', LogoutView.as_view(), name='logout'),
19-
path('change-password/', ChangePasswordView.as_view(), name='change_pass'),
19+
path('change-password/', ChangePasswordView.as_view(), name='change_password'),
2020
path('profile/', ProfileView.as_view(), name='profile'),
2121

2222
# User views
@@ -26,9 +26,9 @@
2626
path('users/<int:pk>/view/', UserDetailView.as_view(), name='view_user'),
2727
path('users/<int:pk>/delete/', UserDeleteView.as_view(), name='remove_user'),
2828

29-
url(r'^password_reset/$',auth_views.password_reset,name='password_reset'),
30-
url(r'^passowrd-reset/done/$',auth_views.password_reset_done,name='password_reset_done'),
31-
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
29+
path('password-reset/', auth_views.password_reset, name='password_reset'),
30+
path('password-reset/done/', auth_views.password_reset_done, name='password_reset_done'),
31+
path('reset/uidb64>/<token>/',
3232
auth_views.password_reset_confirm, name='password_reset_confirm'),
33-
url(r'^reset/done/$', auth_views.password_reset_complete, name='password_reset_complete'),
33+
path('reset/done/', auth_views.password_reset_complete, name='password_reset_complete'),
3434
]

‎crm/settings.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@
128128

129129

130130
EMAIL_HOST = 'smtp.sendgrid.net'
131-
EMAIL_HOST_USER = '****'
132-
EMAIL_HOST_PASSWORD = '*******'
131+
EMAIL_HOST_USER = os.getenv('SG_USER', '')
132+
EMAIL_HOST_PASSWORD = os.getenv('SG_PWD', '')
133133
EMAIL_PORT = 587
134134
EMAIL_USE_TLS = True
135135

‎crm/urls.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
app_name = 'crm'
55

66
urlpatterns = [
7-
path('', include('common.urls', namespace="common")),
8-
path('accounts/', include('accounts.urls', namespace="accounts")),
9-
path('leads/', include('leads.urls', namespace="leads")),
10-
path('contacts/', include('contacts.urls', namespace="contacts")),
11-
path('opportunities/', include('opportunity.urls', namespace="opportunities")),
12-
path('cases/', include('cases.urls', namespace="cases")),
13-
path('emails/', include('emails.urls', namespace="emails")),
14-
# path('planner/', include('planner.urls', namespace="planner")),
15-
path('logout/', views.logout, {'next_page': '/login/'}, name="logout"),
7+
path('', include('common.urls', namespace="common")),
8+
path('', include('django.contrib.auth.urls')),
9+
path('accounts/', include('accounts.urls', namespace="accounts")),
10+
path('leads/', include('leads.urls', namespace="leads")),
11+
path('contacts/', include('contacts.urls', namespace="contacts")),
12+
path('opportunities/', include('opportunity.urls', namespace="opportunities")),
13+
path('cases/', include('cases.urls', namespace="cases")),
14+
path('emails/', include('emails.urls', namespace="emails")),
15+
# path('planner/', include('planner.urls', namespace="planner")),
16+
path('logout/', views.logout, {'next_page': '/login/'}, name="logout"),
1617
]

‎requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Django==2.1
1+
Django==2.0.7
22
django-simple-pagination==1.1.8
33
pytz==2018.3
44
psycopg2-binary==2.7.4

‎static/css/main.scss

+5-2
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,15 @@ a{
6767
.form-group {
6868
margin-bottom: 15px;
6969
}
70+
.errorlist li{
71+
color: red;
72+
}
7073
label {
71-
font-size: 12px;
74+
font-size: 14px;
7275
color: darken($text_color2, 15%);
7376
font-weight:500;
7477
}
75-
.form-control {
78+
.form-control, input {
7679
color: $text_color;
7780
min-height: 40px;
7881
font-size: 13px;

‎templates/base.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
2727
<span class="navbar-toggler-icon"></span>
2828
</button>
29-
29+
{% if request.user.is_authenticated %}
3030
<div class="collapse navbar-collapse" id="navbarSupportedContent">
3131
<ul class="navbar-nav mr-auto">
3232
{% if request.user.role == "ADMIN" %}
@@ -53,14 +53,15 @@
5353
{% endwith %}
5454
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
5555
{% if request.user.role == "USER" %}
56-
<a class="dropdown-item" href="/change-password/"><i class="fas fa-key"></i> Change Password</a>
56+
<a class="dropdown-item" href="{% url 'common:change_password' %}"><i class="fas fa-key"></i> Change Password</a>
5757
{% endif %}
5858
<a class="dropdown-item" href="{% url 'common:profile' %}"><i class="fas fa-user"></i> Profile</a>
5959
<a class="dropdown-item" href="{% url 'common:logout' %}"><i class="fas fa-sign-out-alt"></i> Logout</a>
6060
</div>
6161
</li>
6262
</ul>
6363
</div>
64+
{% endif %}
6465
</nav>
6566
</header>
6667
<!-- header ends here -->
@@ -88,7 +89,7 @@
8889
<script type="text/javascript">
8990
$(document).ready(function(){
9091
word = window.location.pathname.split('/')[1]
91-
$('#'+word).addClass('active')
92+
$('#' + word).addClass('active')
9293
})
9394
</script>
9495
</body>

‎templates/change_password.html

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,23 @@
1212
</div>
1313
<div class="row marl no-gutters">
1414
<div class="col-md-12">
15-
1615
{% if not user_obj %}
1716
<div class="filter_col col-md-12">
1817
<div class="form-group">
1918
<label for="exampleInputEmail1">Old Password</label>
20-
<input type="password" class="form-control" name="CurrentPassword" value="{{request.POST.CurrentPassword}}">
19+
<input type="password" class="form-control" name="CurrentPassword" value="{{ request.POST.CurrentPassword }}">
2120
</div>
2221
<span class="error">{{ errors.CurrentPassword }}</span>
2322
{% if error %}
24-
<span class="error">{{error}}</span>
23+
<span class="error">{{ error }}</span>
2524
{% endif %}
2625
</div>
2726
{% endif %}
2827
{% if not user_obj %}
2928
<div class="filter_col col-md-12">
3029
<div class="form-group">
3130
<label for="exampleInputEmail1">New Password</label>
32-
<input type="password" class="form-control" name="Newpassword" value="{{request.POST.Newpassword}}">
31+
<input type="password" class="form-control" name="Newpassword" value="{{ request.POST.Newpassword }}">
3332
</div>
3433
<span class="error">{{ errors.Newpassword }}</span>
3534
</div>
@@ -38,7 +37,7 @@
3837
<div class="filter_col col-md-12">
3938
<div class="form-group">
4039
<label for="exampleInputEmail1">Confirm New Password</label>
41-
<input type="password" class="form-control" name="confirm" value="{{request.POST.confirm}}">
40+
<input type="password" class="form-control" name="confirm" value="{{ request.POST.confirm }}">
4241
</div>
4342
<span class="error">{{ errors.confirm }}</span>
4443
</div>

‎templates/forgot_password.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
<div class="form-group">
3333
<input type="text" class="form-control" id="exampleInputEmail1" placeholder="Email" name="email">
3434
</div>
35-
36-
<div class="forgot">Back to login <a href="/login/">Click Here?</a></div>
35+
<div class="forgot">Back to login <a href="{% url "common:login" %}">Click Here?</a></div>
3736
<button type="submit" class="btn btn-danger">Reset Password</button>
3837
</form>
3938
</div>

‎templates/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{% extends 'base.html' %}
2-
<a href="/logout/"><button class="btn btn-primary" type="button">Logout</button></a
2+
<a href="{% url "common:logout" %}"><button class="btn btn-primary" type="button">Logout</button></a

‎templates/login.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<div class="form-group">
3636
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" name="password">
3737
</div>
38-
<div class="forgot">Forgot Password <a href="/password-reset/">Click Here?</a></div>
38+
<div class="forgot">Forgot Password <a href="{% url "common:password_reset" %}">Click Here?</a></div>
3939
{% if error %}
4040
<p>{{ message }}</p>
4141
{% endif %}

‎templates/profile.html

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<div class="overview_form_block row marl justify-content-center">
77
<div class="col-md-6">
88
<div class="card">
9-
109
<div class="card-body" id="datashow">
1110
<div class="panel-heading card-title view-pad text-center">
1211
<h5>

‎templates/registration/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<div class="row marl justify-content-center login_row">
2727
<div class="col-md-6 col-lg-6 col-xl-4">
2828
{% block content %}
29-
29+
3030
{% endblock %}
3131
</div>
3232
</div>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{% extends 'base.html' %}
2-
32
{% block content %}
4-
<p>
5-
Your password has been set. You may go ahead and <a href="{% url 'common:login' %}">sign in</a> now.
6-
</p>
3+
<div class="row marl justify-content-center login_row">
4+
<div class="col-md-12 col-lg-6 col-xl-4">
5+
<div class="login_block">
6+
<div class="login_form_block">
7+
Your password has been set. You may go ahead and <a href="{% url 'common:login' %}">sign in</a> now.
8+
</div>
9+
</div>
10+
</div>
11+
</div>
712
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
{% extends 'registration/base.html' %}
2-
1+
{% extends 'base.html' %}
32
{% block content %}
4-
{% if validlink %}
5-
<h3>Change password</h3>
6-
<form method="post">
7-
{% csrf_token %}
8-
{{ form.as_p }}
9-
<button type="submit" class="btn btn-danger">Change password</button>
10-
</form>
11-
{% else %}
12-
<p>
13-
The password reset link was invalid, possibly because it has already been used.
14-
Please request a new password reset.
15-
</p>
16-
{% endif %}
3+
<div class="row marl justify-content-center login_row">
4+
<div class="col-md-6 col-lg-6 col-xl-4">
5+
<div class="login_block">
6+
<div class="login_form_block">
7+
{% if validlink %}
8+
<h3 class="welcome">Change password</h3>
9+
<form method="post">
10+
{% csrf_token %}
11+
{{ form.as_p }}
12+
<button type="submit" class="btn btn-danger">Change password</button>
13+
</form>
14+
{% else %}
15+
<p>
16+
The password reset link was invalid, possibly because it has already been used.
17+
Please request a new password reset.
18+
</p>
19+
{% endif %}
20+
</div>
21+
</div>
22+
</div>
23+
</div>
1724
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
{% extends 'registration/base.html' %}
22
{% block content %}
3-
<p>
4-
We've emailed you instructions for setting your password, if an account exists with the email you entered.
5-
You should receive them shortly.
6-
</p>
7-
<p>
8-
If you don't receive an email, please make sure you've entered the address you registered with,
9-
and check your spam folder.
10-
</p>
3+
<div class="ow marl justify-content-center login_row">
4+
<div class="login_block">
5+
<div class="login_form_block">
6+
<div class="welcome">Django CRM</div>
7+
<p>
8+
We've emailed you instructions for setting your password, if an account exists with the email you entered.
9+
You should receive them shortly.
10+
</p>
11+
<p>
12+
If you don't receive an email, please make sure you've entered the address you registered with,
13+
and check your spam folder.
14+
</p>
15+
</div>
16+
</div>
17+
</div>
1118
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
{% autoescape off %}
2-
To initiate the password reset process for your {{ user.get_username }} TestSite Account,
2+
To initiate the password reset process for your {{ user.get_username }} Django-CRM Account,
33
click the link below:
4-
54
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
6-
75
If clicking the link above doesn't work, please copy and paste the URL in a new browser
86
window instead.
9-
107
Sincerely,
11-
The TestSite Team
8+
The Django-CRM Team
129
{% endautoescape %}

‎templates/registration/password_reset_form.html

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
{% extends 'registration/base.html' %}
22
{% block content %}
33

4-
<div class="card">
5-
<div class="card-body">
4+
<div class="login_block">
5+
<div class="login_form_block">
66
<div class="card-title">
7-
<center><h2>Forgot password</center></h2>
7+
<center><h2 class="welcome">Forgot password</center></h2>
88
</div>
99
<form method="post">
1010
<div class="form-group">
1111
<input type="text" class="form-control" id="exampleinputmail" placeholder="Email" name="email">
1212
</div>
1313
{% csrf_token %}
14-
1514
<center><button type="submit" class="btn btn-danger">Submit</button></center>
1615
</form>
1716
</div>

0 commit comments

Comments
 (0)
Please sign in to comment.