JSHint fixes and $timeout mocks

Fixes to pass JSHint checks
LoginControllerSpec now uses $timeout mock to flush pending promise queues.