blob: d95859a493402630cb0850f8e3337d2ff2d85797 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
from changepw.models import ChangePasswordForm
from django import forms
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect
import subprocess
def change_password(request):
if request.method == 'POST':
form = ChangePasswordForm(request.POST)
if form.is_valid():
new_password = form.cleaned_data['new_password']
# Get user name and additional info from headers
# Magic for actually changing the password happens here
return_value = subprocess.call(['echo', new_password])
return render_to_response('changepw/change_password.html',
{'return_value': return_value},
context_instance=RequestContext(request))
else:
form = ChangePasswordForm()
return render_to_response('changepw/change_password.html',
{'form': form },
context_instance=RequestContext(request))
|