Refactor login form
Refactor to separate script