Refactored login procedure for reusability
Moved jshomeDatabase tests to the right location
Moved the login stuff to core
Defined login directive