#NEWLINE# @ auth . route ( '/reset' , methods = [ 'GET' , 'POST' ] ) #NEWLINE# def password_reset_request( ) : #NEWLINE# #INDENT# if ( not current_user . is_anonymous ) : #NEWLINE# #INDENT# return redirect ( url_for ( 'main.index' ) ) #NEWLINE# #UNINDENT# form = PasswordResetRequestForm ( ) #NEWLINE# if form . validate_on_submit ( ) : #NEWLINE# #INDENT# user = User . query . filter_by ( email = form . email . data . lower ( ) . strip ( ) ) . first ( ) #NEWLINE# if user : #NEWLINE# #INDENT# token = user . generate_reset_token ( ) #NEWLINE# send_email ( user . email , 'Reset Your Password' , 'auth/email/reset_password' , user = user , token = token , next = request . args . get ( 'next' ) ) #NEWLINE# #UNINDENT# flash ( 'An email with instructions to reset your password has been sent to you.' ) #NEWLINE# return redirect ( url_for ( 'auth.login' ) ) #NEWLINE# #UNINDENT# return render_template ( 'auth/reset_password.html' , form = form )