Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change password added to dashboard #90

Merged
merged 33 commits into from Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7a28ee0
seo data added
Jul 18, 2016
c940236
Merge branch 'master' of github.com:MicroPyramid/django-blog-it into …
Jul 18, 2016
a377fd5
merge conflicts solved
Jul 18, 2016
9f985bf
FBV to CBV
Jul 18, 2016
f3f1962
test cases fixed
Jul 18, 2016
e161b3b
converted fbv to cbv
Jul 19, 2016
2375520
merge conflicts resolved
Jul 19, 2016
7cdcad8
travis fixed
Jul 19, 2016
91a71e7
migrations added
Jul 19, 2016
621a797
new migrations added
Jul 19, 2016
f72b836
redirected to dashboard blog page if user already logged in
Jul 20, 2016
dcbfa61
merge conflicts solved
Jul 20, 2016
7f6aad7
migrations changed
Jul 20, 2016
f71db38
sharing blog post in fb, g+, tw, Linkdin
Jul 20, 2016
07910fd
merge conflicts solved
Jul 20, 2016
5dcc776
share links added in new blog post view page
Jul 20, 2016
fc6c6fd
test case fixed
Jul 20, 2016
ec7a50e
meta data included in new_base.html
Jul 20, 2016
4ee57e2
Merge branch 'master' of github.com:MicroPyramid/django-blog-it into …
Jul 20, 2016
04098a0
google captcha added to blog contact page
Jul 20, 2016
70d918c
google analytics code added
Jul 20, 2016
4b71b61
Merge branch 'master' of github.com:MicroPyramid/django-blog-it into …
Jul 20, 2016
be8ccd5
email sent to admin and user contact us page
Jul 20, 2016
19bbfbd
Merge branch 'master' of github.com:MicroPyramid/django-blog-it into …
Jul 20, 2016
25efe92
favicon added
Jul 21, 2016
55b4ea8
merge conflict solved
Jul 21, 2016
8fad5a2
link added
Jul 21, 2016
007fbe2
Merge branch 'master' of github.com:MicroPyramid/django-blog-it into …
Jul 21, 2016
dd9aad5
Merge branch 'master' of github.com:MicroPyramid/django-blog-it into …
Jul 22, 2016
f6920bd
password change added
Jul 27, 2016
51024ab
merge conflicts solved
Jul 27, 2016
465a22e
Update README.rst
Jul 28, 2016
3a99aa7
Update README.rst
Jul 28, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,17 @@ Installation

python setup.py install

2. Add app name in settings.py::

2. After installing/cloning this, add the following settings in the virtual env/bin/activate file to start discussions on blog articles ::
INSTALLED_APPS = [
'..................',
'simple_pagination',
'django_blog_it.django_blog_it',
'..................'
]


3. After installing/cloning this, add the following settings in the virtual env/bin/activate file to start discussions on blog articles ::

You can create your disqus account at https://disqus.com/profile/login/

Expand Down Expand Up @@ -111,7 +120,7 @@ Installation
export DEFAULT_EMAIL


3. Use virtualenv to install requirements::
4. Use virtualenv to install requirements::

pip install -r requirements.txt

Expand Down
12 changes: 12 additions & 0 deletions django_blog_it/django_blog_it/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,15 @@ def __init__(self, *args, **kwargs):
self.fields[field].widget.attrs.update({
'class': 'form-control'
})


class ChangePasswordForm(forms.Form):
password = forms.CharField(widget=forms.PasswordInput(attrs={"class": "form-control"}))
confirm_password = forms.CharField(widget=forms.PasswordInput(attrs={"class": "form-control"}))

def clean_confirm_password(self):
password = self.cleaned_data.get("password")
confirm_password = self.cleaned_data.get("confirm_password")
if password != confirm_password:
raise forms.ValidationError("Passwords do not match!!!")
return confirm_password
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{request.user}} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url 'change_password' %}"><i class="fa fa-key" aria-hidden="true"></i> Change Password</a></li>
<li><a href="{% url 'admin_logout' %}"><i class="fa fa-sign-out"></i> Logout</a></li>
</ul>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% extends 'dashboard/new_base.html' %}
{% block title %}
Change Password
{% endblock %}
{% block content %}
<div class="row no_row_margin heading_count">
<div class="heading col-md-6" id='page_title'>
Change Password
</div>
</div>
<!-- end class of row -->
<div class="row no_row_margin">
<div class="container-fluid">
<form action="" id="post-form" enctype="multipart/form-data" method="post" role="form">
{% csrf_token %}
<div class="row form_row no_row_margin">
<div class="col-md-12">
<div class="col-md-6">
{% for field in form %}
<div class="form-group col-md-12">
<label>{{ field.label }} :</label>
<div class="controls">
{{ field }}
{% if field.help_text %}
<p class="help-inline"><small>{{ field.help_text }}</small></p>
{% endif %}
<p> {{ field.errors }} </p>
</div>
</div>
{% endfor %}
</div>
</div>
<br clear="all">
<div class=" col-md-12 buttons_row text-left">
<div class="form-group">
<button type="submit" class="btn btn-default green_btn"> <i class="fa fa-floppy-o" aria-hidden="true"></i> Submit</button>
<button type="reset" class="btn btn-default blue_btn"> <i class="fa fa-refresh" aria-hidden="true"></i> Reset</button>
</div>
</div>
</div>
</form>
</div>
</div>
<!-- end div row of form -->
{% endblock %}
17 changes: 16 additions & 1 deletion django_blog_it/django_blog_it/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.urlresolvers import reverse, reverse_lazy
from django.views.generic import ListView, DetailView, CreateView, DeleteView,\
UpdateView, FormView, TemplateView, View
Expand Down Expand Up @@ -994,7 +995,6 @@ def bulk_actions_themes(request):
messages.warning(request, 'Please select at-least one record to perform this action')
return HttpResponse(json.dumps({'response': False}))


# social login
def google_login(request):
if 'code' in request.GET:
Expand Down Expand Up @@ -1157,3 +1157,18 @@ def facebook_login(request):
else:
rty = "https://graph.facebook.com/oauth/authorize?client_id=" + os.getenv("FB_APP_ID") + "&redirect_uri=" + 'https://' + request.META['HTTP_HOST'] + reverse('facebook_login') + "&scope=manage_pages,read_stream, user_about_me, user_birthday, user_location, user_work_history, user_hometown, user_website, email, user_likes, user_groups"
return HttpResponseRedirect(rty)


class ChangePasswordView(LoginRequiredMixin, FormView):
template_name = "dashboard/user/change_password.html"
form_class = ChangePasswordForm
success_url = reverse_lazy("blog")

def form_valid(self, form):
user = self.request.user
user.set_password(form.cleaned_data.get("password"))
user.save()
user = authenticate(username=user.username, password=form.cleaned_data.get("password"))
login(self.request, user)
messages.success(self.request, "your password has been changed!!!")
return super(ChangePasswordView, self).form_valid(form)
1 change: 1 addition & 0 deletions django_blog_it/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,6 @@

url(r'^dashboard/contactUs/$',
configure_contact_us, name='configure_contact_us'),
url(r'^dashboard/change-password/$', ChangePasswordView.as_view(), name='change_password'),

] + static(MEDIA_URL, document_root=MEDIA_ROOT)