Flask Python Framework: login form and logic