#NEWLINE# @ main . route ( '/login' , methods = [ 'POST' ] ) #NEWLINE# def login( ) : #NEWLINE# #INDENT# username = request . form [ 'username' ] #NEWLINE# password = request . form [ 'password' ] #NEWLINE# user = User . query . filter_by ( username = username ) . first ( ) #NEWLINE# if ( ( not password ) or ( not user . check_password ( password ) ) ) : #NEWLINE# #INDENT# return ( 'Authentication error' , 401 ) #NEWLINE# #UNINDENT# login_user ( user ) #NEWLINE# return 'Logged in'