login protect the form list, 404 instead of 500-ing when no form found

- fixes Case:54012
- also clean imports and fix warnings