#NEWLINE# @ sensitive_post_parameters ( ) #NEWLINE# @ csrf_protect #NEWLINE# @ login_required #NEWLINE# @ deprecate_current_app #NEWLINE# def password_change( request , template_name = 'registration/password_change_form.html' , post_change_redirect = None , password_change_form = PasswordChangeForm , extra_context = None ) : #NEWLINE# #INDENT# if ( post_change_redirect is None ) : #NEWLINE# #INDENT# post_change_redirect = reverse ( 'password_change_done' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# post_change_redirect = resolve_url ( post_change_redirect ) #NEWLINE# #UNINDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = password_change_form ( user = request . user , data = request . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# form . save ( ) #NEWLINE# update_session_auth_hash ( request , form . user ) #NEWLINE# return HttpResponseRedirect ( post_change_redirect ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = password_change_form ( user = request . user ) #NEWLINE# #UNINDENT# context = { #NEWLINE# #INDENT# 'form' : form , #NEWLINE# 'title' : _ ( 'Password change' ) , #NEWLINE# #UNINDENT# } #NEWLINE# if ( extra_context is not None ) : #NEWLINE# #INDENT# context . update ( extra_context ) #NEWLINE# #UNINDENT# return TemplateResponse ( request , template_name , context )