edit template login.html with wtforms. refactor login endpoint with wtforms