#NEWLINE# @ never_cache #NEWLINE# def password_reset_confirm( request , uidb64 = None , token = None , template_name = 'registration/password_reset_confirm.html' , token_generator = default_token_generator , set_password_form = SetPasswordForm , post_reset_redirect = None , current_app = None , extra_context = None ) : #NEWLINE# #INDENT# '\n    View that checks the hash in a password reset link and presents a\n    form for entering a new password.\n    ' #NEWLINE# assert ( ( uidb64 is not None ) and ( token is not None ) ) #NEWLINE# if ( post_reset_redirect is None ) : #NEWLINE# #INDENT# post_reset_redirect = reverse ( 'django.contrib.auth.views.password_reset_complete' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# uid = urlsafe_base64_decode ( str ( uidb64 ) ) #NEWLINE# user = User . objects . get ( id = uid ) #NEWLINE# #UNINDENT# except ( TypeError , ValueError , User . DoesNotExist ) : #NEWLINE# #INDENT# user = None #NEWLINE# #UNINDENT# if ( ( user is not None ) and token_generator . check_token ( user , token ) ) : #NEWLINE# #INDENT# validlink = True #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = set_password_form ( user , request . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# form . save ( ) #NEWLINE# return HttpResponseRedirect ( post_reset_redirect ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = set_password_form ( None ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# validlink = False #NEWLINE# form = None #NEWLINE# #UNINDENT# context = { #NEWLINE# #INDENT# 'form' : form , #NEWLINE# 'validlink' : validlink , #NEWLINE# #UNINDENT# } #NEWLINE# context . update ( ( extra_context or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# return render_to_response ( template_name , context , context_instance = RequestContext ( request , current_app = current_app ) )