(refactor) move auth functions out of ctrl to factory

also moved the `<div id="fb-root"></div>` to index.html after the opening body tag