Fix 2 Bugs: Password-View did not return a response, Wifi-Password was not set yet. Users had to login with their old password which caused confusion.
This commit is contained in:
parent
141b48a2c6
commit
7c124bed31
2 changed files with 11 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import os
|
||||
import hashlib
|
||||
import smbpasswd
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponseRedirect
|
||||
|
|
@ -163,7 +164,15 @@ def password(request):
|
|||
|
||||
if form.is_valid():
|
||||
new_password = form.cleaned_data['password1']
|
||||
|
||||
# change the password for the Wifi
|
||||
member.set('sambaLMPassword', smbpasswd.lmhash(new_password))
|
||||
member.set('sambaNTPassword', smbpasswd.nthash(new_password))
|
||||
member.save()
|
||||
|
||||
# change the LDAP password
|
||||
member.change_password(new_password)
|
||||
|
||||
key = store_ldap_password(request, new_password)
|
||||
request.session.save()
|
||||
new_form = PasswordForm()
|
||||
|
|
@ -171,6 +180,7 @@ def password(request):
|
|||
{'message': _('Your password was changed. Thank you!'),
|
||||
'form': new_form, 'member': member.to_dict()})
|
||||
response.set_cookie('sessionkey', key)
|
||||
return response
|
||||
else:
|
||||
return render(request, 'password.html',
|
||||
{'form': form, 'member': member.to_dict()})
|
||||
|
|
|
|||
|
|
@ -4,3 +4,4 @@ django-auth-ldap==1.1.4
|
|||
django-json-rpc==0.6.1
|
||||
django-crispy-forms==1.4.0
|
||||
pycrypto==2.6.1
|
||||
smbpasswd==1.0.2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue