Refactor the login form so it uses FormUI

Fixes #461