#NEWLINE# def reset_password( request ) : #NEWLINE# #INDENT# response_data = { #NEWLINE# #INDENT# 'status' : 'failure' , #NEWLINE# 'message' : 'unknown error occured' , #NEWLINE# #UNINDENT# } #NEWLINE# if request . is_ajax ( ) : #NEWLINE# #INDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = ForgotPasswordForm ( request . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# email = request . POST [ 'email' ] #NEWLINE# new_password = create_random_password ( email ) #NEWLINE# response_data = send_email ( email , new_password ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# response_data = { #NEWLINE# #INDENT# 'status' : 'failed' , #NEWLINE# 'message' : json . dumps ( form . errors ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return HttpResponse ( json . dumps ( response_data ) , content_type = 'application/json' )