|
32 | 32 |
|
33 | 33 | # Copyright The IETF Trust 2007, All Rights Reserved |
34 | 34 |
|
35 | | -import importlib |
36 | | - |
37 | 35 | from datetime import datetime as DateTime, timedelta as TimeDelta, date as Date |
38 | 36 | from collections import defaultdict |
39 | 37 |
|
40 | | -import django.core.signing |
41 | | -from django import forms |
42 | | -from django.contrib import messages |
43 | 38 | from django.conf import settings |
44 | | -from django.contrib.auth import update_session_auth_hash |
| 39 | +from django.http import Http404 #, HttpResponse, HttpResponseRedirect |
| 40 | +from django.shortcuts import render, redirect, get_object_or_404 |
| 41 | +#from django.contrib.auth import REDIRECT_FIELD_NAME, authenticate, login |
45 | 42 | from django.contrib.auth.decorators import login_required |
46 | | -from django.contrib.auth.models import User |
| 43 | +#from django.utils.http import urlquote |
| 44 | +import django.core.signing |
47 | 45 | from django.contrib.sites.models import Site |
48 | | -from django.core.urlresolvers import reverse as urlreverse |
49 | | -from django.http import Http404, HttpResponseRedirect #, HttpResponse, |
50 | | -from django.shortcuts import render, redirect, get_object_or_404 |
| 46 | +from django.contrib.auth.models import User |
| 47 | +from django import forms |
51 | 48 |
|
52 | 49 | import debug # pyflakes:ignore |
53 | 50 |
|
54 | 51 | from ietf.group.models import Role, Group |
55 | | -from ietf.ietfauth.forms import RegistrationForm, PasswordForm, ResetPasswordForm, TestEmailForm, WhitelistForm, ChangePasswordForm |
| 52 | +from ietf.ietfauth.forms import RegistrationForm, PasswordForm, ResetPasswordForm, TestEmailForm, WhitelistForm |
56 | 53 | from ietf.ietfauth.forms import get_person_form, RoleEmailForm, NewEmailForm |
57 | 54 | from ietf.ietfauth.htpasswd import update_htpasswd_file |
58 | 55 | from ietf.ietfauth.utils import role_required |
@@ -468,46 +465,3 @@ def review_overview(request): |
468 | 465 | 'review_wishes': review_wishes, |
469 | 466 | 'review_wish_form': review_wish_form, |
470 | 467 | }) |
471 | | - |
472 | | -@login_required |
473 | | -def change_password(request): |
474 | | - success = False |
475 | | - person = None |
476 | | - |
477 | | - try: |
478 | | - person = request.user.person |
479 | | - except Person.DoesNotExist: |
480 | | - return render(request, 'registration/missing_person.html') |
481 | | - |
482 | | - emails = Email.objects.filter(person=person, active=True).order_by('-primary','-time').first |
483 | | - |
484 | | - if request.method == 'POST': |
485 | | - user = request.user |
486 | | - form = ChangePasswordForm(user, request.POST) |
487 | | - if form.is_valid(): |
488 | | - new_password = form.cleaned_data["new_password"] |
489 | | - |
490 | | - user.set_password(new_password) |
491 | | - user.save() |
492 | | - # password is also stored in htpasswd file |
493 | | - update_htpasswd_file(user.username, new_password) |
494 | | - # keep the session |
495 | | - update_session_auth_hash(request, user) |
496 | | - |
497 | | - messages.success(request, "Your password was successfully changed") |
498 | | - return HttpResponseRedirect(urlreverse('ietf.ietfauth.views.profile')) |
499 | | - |
500 | | - else: |
501 | | - form = ChangePasswordForm(request.user) |
502 | | - |
503 | | - hlibname, hashername = settings.PASSWORD_HASHERS[0].rsplit('.',1) |
504 | | - |
505 | | - hlib = importlib.import_module(hlibname) |
506 | | - hasher = getattr(hlib, hashername) |
507 | | - return render(request, 'registration/change_password.html', { |
508 | | - 'form': form, |
509 | | - 'success': success, |
510 | | - 'hasher': hasher, |
511 | | - }) |
512 | | - |
513 | | - |
0 commit comments