bocoup/rave — pull request #24 by jmeas (2014-07-29 20:20:47+00:00)
Title: Adds authentication to ui-router.

This adds authentication to the ui router.

- A new property is added to our router states: `authenticated`.
- On route change, we check if the route needs authentication (in other words: `authenticated: true`).
- If yes, we check if the user's token in a verification method. This is only called once.
- If the token is valid, all is well and they route.
- If the token isn't valid, we destroy it and send them to the login page.
- Their attempted state change is stored on `$rootScope` so that the login page can redirect them to the proper page after they've logged in (to be added in a future PR)