#NEWLINE# @ app . route ( '/login' , methods = [ 'GET' , 'POST' ] ) #NEWLINE# def login( ) : #NEWLINE# #INDENT# error = None #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# user = login_user ( request . form . get ( 'username' ) , request . form . get ( 'password' ) ) #NEWLINE# if user : #NEWLINE# #INDENT# flash ( 'Successful login.' ) #NEWLINE# return redirect ( '/user' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# error = 'Invalid login.' #NEWLINE# #UNINDENT# #UNINDENT# return render_template ( 'login.html' , error = error )