Skip to content

Commit

Permalink
Reset password (#60)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nikhila05 committed Aug 5, 2018
1 parent ecc3e88 commit 508e048
Show file tree
Hide file tree
Showing 18 changed files with 95 additions and 72 deletions.
12 changes: 9 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ Django-CRM
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.


.. image:: https://coveralls.io/repos/github/MicroPyramid/Django-CRM/badge.svg?branch=master
:target: https://coveralls.io/github/MicroPyramid/Django-CRM?branch=master

.. image:: https://landscape.io/github/MicroPyramid/Django-CRM/master/landscape.svg?style=flat
:target: https://landscape.io/github/MicroPyramid/Django-CRM/master
:alt: Code Health
Expand All @@ -23,10 +20,19 @@ Django CRM is opensourse CRM developed on django framework. It has all the basic
- Codacy
- Support
* - .. image:: https://travis-ci.org/MicroPyramid/Django-CRM.svg?branch=master
:target: https://travis-ci.org/MicroPyramid/Django-CRM
- .. image:: https://api.codacy.com/project/badge/Grade/b11da5f09dd542479fd3bd53944595d2
:target: https://app.codacy.com/project/ashwin/Django-CRM/dashboard
:alt: Codacy Dashboard
.. image:: https://api.codacy.com/project/badge/Coverage/b11da5f09dd542479fd3bd53944595d2
:target: https://app.codacy.com/project/ashwin/Django-CRM/dashboard
:alt: Codacy Coverage
- .. image:: https://badges.gitter.im/Micropyramid/Django-CRM.png
:target: https://gitter.im/MicroPyramid/Django-CRM
:alt: Gitter
.. image:: https://www.codetriage.com/micropyramid/django-crm/badges/users.svg
:target: https://www.codetriage.com/micropyramid/django-crm
:alt: Code Helpers


http://django-crm.readthedocs.io for latest documentation
Expand Down
10 changes: 5 additions & 5 deletions common/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
path('login/', LoginView.as_view(), name='login'),
path('forgot-password/', ForgotPasswordView.as_view(), name='forgot_password'),
path('logout/', LogoutView.as_view(), name='logout'),
path('change-password/', ChangePasswordView.as_view(), name='change_pass'),
path('change-password/', ChangePasswordView.as_view(), name='change_password'),
path('profile/', ProfileView.as_view(), name='profile'),

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

url(r'^password_reset/$',auth_views.password_reset,name='password_reset'),
url(r'^passowrd-reset/done/$',auth_views.password_reset_done,name='password_reset_done'),
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
path('password-reset/', auth_views.password_reset, name='password_reset'),
path('password-reset/done/', auth_views.password_reset_done, name='password_reset_done'),
path('reset/uidb64>/<token>/',
auth_views.password_reset_confirm, name='password_reset_confirm'),
url(r'^reset/done/$', auth_views.password_reset_complete, name='password_reset_complete'),
path('reset/done/', auth_views.password_reset_complete, name='password_reset_complete'),
]
4 changes: 2 additions & 2 deletions crm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@


EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = '****'
EMAIL_HOST_PASSWORD = '*******'
EMAIL_HOST_USER = os.getenv('SG_USER', '')
EMAIL_HOST_PASSWORD = os.getenv('SG_PWD', '')
EMAIL_PORT = 587
EMAIL_USE_TLS = True

Expand Down
19 changes: 10 additions & 9 deletions crm/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
app_name = 'crm'

urlpatterns = [
path('', include('common.urls', namespace="common")),
path('accounts/', include('accounts.urls', namespace="accounts")),
path('leads/', include('leads.urls', namespace="leads")),
path('contacts/', include('contacts.urls', namespace="contacts")),
path('opportunities/', include('opportunity.urls', namespace="opportunities")),
path('cases/', include('cases.urls', namespace="cases")),
path('emails/', include('emails.urls', namespace="emails")),
# path('planner/', include('planner.urls', namespace="planner")),
path('logout/', views.logout, {'next_page': '/login/'}, name="logout"),
path('', include('common.urls', namespace="common")),
path('', include('django.contrib.auth.urls')),
path('accounts/', include('accounts.urls', namespace="accounts")),
path('leads/', include('leads.urls', namespace="leads")),
path('contacts/', include('contacts.urls', namespace="contacts")),
path('opportunities/', include('opportunity.urls', namespace="opportunities")),
path('cases/', include('cases.urls', namespace="cases")),
path('emails/', include('emails.urls', namespace="emails")),
# path('planner/', include('planner.urls', namespace="planner")),
path('logout/', views.logout, {'next_page': '/login/'}, name="logout"),
]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==2.1
Django==2.0.7
django-simple-pagination==1.1.8
pytz==2018.3
psycopg2-binary==2.7.4
Expand Down
7 changes: 5 additions & 2 deletions static/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ a{
.form-group {
margin-bottom: 15px;
}
.errorlist li{
color: red;
}
label {
font-size: 12px;
font-size: 14px;
color: darken($text_color2, 15%);
font-weight:500;
}
.form-control {
.form-control, input {
color: $text_color;
min-height: 40px;
font-size: 13px;
Expand Down
7 changes: 4 additions & 3 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

{% if request.user.is_authenticated %}
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
{% if request.user.role == "ADMIN" %}
Expand All @@ -53,14 +53,15 @@
{% endwith %}
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
{% if request.user.role == "USER" %}
<a class="dropdown-item" href="/change-password/"><i class="fas fa-key"></i> Change Password</a>
<a class="dropdown-item" href="{% url 'common:change_password' %}"><i class="fas fa-key"></i> Change Password</a>
{% endif %}
<a class="dropdown-item" href="{% url 'common:profile' %}"><i class="fas fa-user"></i> Profile</a>
<a class="dropdown-item" href="{% url 'common:logout' %}"><i class="fas fa-sign-out-alt"></i> Logout</a>
</div>
</li>
</ul>
</div>
{% endif %}
</nav>
</header>
<!-- header ends here -->
Expand Down Expand Up @@ -88,7 +89,7 @@
<script type="text/javascript">
$(document).ready(function(){
word = window.location.pathname.split('/')[1]
$('#'+word).addClass('active')
$('#' + word).addClass('active')
})
</script>
</body>
Expand Down
9 changes: 4 additions & 5 deletions templates/change_password.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@
</div>
<div class="row marl no-gutters">
<div class="col-md-12">

{% if not user_obj %}
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">Old Password</label>
<input type="password" class="form-control" name="CurrentPassword" value="{{request.POST.CurrentPassword}}">
<input type="password" class="form-control" name="CurrentPassword" value="{{ request.POST.CurrentPassword }}">
</div>
<span class="error">{{ errors.CurrentPassword }}</span>
{% if error %}
<span class="error">{{error}}</span>
<span class="error">{{ error }}</span>
{% endif %}
</div>
{% endif %}
{% if not user_obj %}
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">New Password</label>
<input type="password" class="form-control" name="Newpassword" value="{{request.POST.Newpassword}}">
<input type="password" class="form-control" name="Newpassword" value="{{ request.POST.Newpassword }}">
</div>
<span class="error">{{ errors.Newpassword }}</span>
</div>
Expand All @@ -38,7 +37,7 @@
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">Confirm New Password</label>
<input type="password" class="form-control" name="confirm" value="{{request.POST.confirm}}">
<input type="password" class="form-control" name="confirm" value="{{ request.POST.confirm }}">
</div>
<span class="error">{{ errors.confirm }}</span>
</div>
Expand Down
3 changes: 1 addition & 2 deletions templates/forgot_password.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
<div class="form-group">
<input type="text" class="form-control" id="exampleInputEmail1" placeholder="Email" name="email">
</div>

<div class="forgot">Back to login <a href="/login/">Click Here?</a></div>
<div class="forgot">Back to login <a href="{% url "common:login" %}">Click Here?</a></div>
<button type="submit" class="btn btn-danger">Reset Password</button>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{% extends 'base.html' %}
<a href="/logout/"><button class="btn btn-primary" type="button">Logout</button></a
<a href="{% url "common:logout" %}"><button class="btn btn-primary" type="button">Logout</button></a
2 changes: 1 addition & 1 deletion templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<div class="form-group">
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" name="password">
</div>
<div class="forgot">Forgot Password <a href="/password-reset/">Click Here?</a></div>
<div class="forgot">Forgot Password <a href="{% url "common:password_reset" %}">Click Here?</a></div>
{% if error %}
<p>{{ message }}</p>
{% endif %}
Expand Down
1 change: 0 additions & 1 deletion templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<div class="overview_form_block row marl justify-content-center">
<div class="col-md-6">
<div class="card">

<div class="card-body" id="datashow">
<div class="panel-heading card-title view-pad text-center">
<h5>
Expand Down
2 changes: 1 addition & 1 deletion templates/registration/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div class="row marl justify-content-center login_row">
<div class="col-md-6 col-lg-6 col-xl-4">
{% block content %}

{% endblock %}
</div>
</div>
Expand Down
13 changes: 9 additions & 4 deletions templates/registration/password_reset_complete.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{% extends 'base.html' %}

{% block content %}
<p>
Your password has been set. You may go ahead and <a href="{% url 'common:login' %}">sign in</a> now.
</p>
<div class="row marl justify-content-center login_row">
<div class="col-md-12 col-lg-6 col-xl-4">
<div class="login_block">
<div class="login_form_block">
Your password has been set. You may go ahead and <a href="{% url 'common:login' %}">sign in</a> now.
</div>
</div>
</div>
</div>
{% endblock %}
37 changes: 22 additions & 15 deletions templates/registration/password_reset_confirm.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
{% extends 'registration/base.html' %}

{% extends 'base.html' %}
{% block content %}
{% if validlink %}
<h3>Change password</h3>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-danger">Change password</button>
</form>
{% else %}
<p>
The password reset link was invalid, possibly because it has already been used.
Please request a new password reset.
</p>
{% endif %}
<div class="row marl justify-content-center login_row">
<div class="col-md-6 col-lg-6 col-xl-4">
<div class="login_block">
<div class="login_form_block">
{% if validlink %}
<h3 class="welcome">Change password</h3>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-danger">Change password</button>
</form>
{% else %}
<p>
The password reset link was invalid, possibly because it has already been used.
Please request a new password reset.
</p>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
23 changes: 15 additions & 8 deletions templates/registration/password_reset_done.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{% extends 'registration/base.html' %}
{% block content %}
<p>
We've emailed you instructions for setting your password, if an account exists with the email you entered.
You should receive them shortly.
</p>
<p>
If you don't receive an email, please make sure you've entered the address you registered with,
and check your spam folder.
</p>
<div class="ow marl justify-content-center login_row">
<div class="login_block">
<div class="login_form_block">
<div class="welcome">Django CRM</div>
<p>
We've emailed you instructions for setting your password, if an account exists with the email you entered.
You should receive them shortly.
</p>
<p>
If you don't receive an email, please make sure you've entered the address you registered with,
and check your spam folder.
</p>
</div>
</div>
</div>
{% endblock %}
7 changes: 2 additions & 5 deletions templates/registration/password_reset_email.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{% autoescape off %}
To initiate the password reset process for your {{ user.get_username }} TestSite Account,
To initiate the password reset process for your {{ user.get_username }} Django-CRM Account,
click the link below:

{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}

If clicking the link above doesn't work, please copy and paste the URL in a new browser
window instead.

Sincerely,
The TestSite Team
The Django-CRM Team
{% endautoescape %}
7 changes: 3 additions & 4 deletions templates/registration/password_reset_form.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{% extends 'registration/base.html' %}
{% block content %}

<div class="card">
<div class="card-body">
<div class="login_block">
<div class="login_form_block">
<div class="card-title">
<center><h2>Forgot password</center></h2>
<center><h2 class="welcome">Forgot password</center></h2>
</div>
<form method="post">
<div class="form-group">
<input type="text" class="form-control" id="exampleinputmail" placeholder="Email" name="email">
</div>
{% csrf_token %}

<center><button type="submit" class="btn btn-danger">Submit</button></center>
</form>
</div>
Expand Down

0 comments on commit 508e048

Please sign in to comment.