#NEWLINE# @ login_required #NEWLINE# def update_password( request ) : #NEWLINE# #INDENT# "\n    Update a user's password\n    " #NEWLINE# user = form . user #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = UpdatePasswordForm ( request . POST , user = user ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# new_pass = make_password ( form . cleaned_data [ 'new_password' ] ) #NEWLINE# user . password = new_pass #NEWLINE# user . save ( ) #NEWLINE# site = get_current_site ( request ) #NEWLINE# messages . success ( request , _ ( 'Your {} password has been updated.' . format ( site . name ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = UpdatePasswordForm ( user = user ) #NEWLINE# #UNINDENT# context = { #NEWLINE# #INDENT# 'form' : form , #NEWLINE# #UNINDENT# } #NEWLINE# return render ( request , 'accounts/update_password.html' , context )