saxifrage / cityasacampus

An open-source platform for connecting and showcasing resources within local learning communities.
http://cityasacampus.org/
5 stars 4 forks source link

Implement Dashboard Auth Route Check #372

Closed MatthewVita closed 8 years ago

MatthewVita commented 8 years ago

In index.js run(...) block, inject our AuthService and listen on $routeChangeStart to see if route contains "dashboard". If so, invoke AuthService.isAuthenticated() to ensure user can be routed.

popular design here: http://stackoverflow.com/a/20971528 (ours is going to be much simpler b/c we can assume 'dashboard' routes are the only ones that need whitelisted)

MatthewVita commented 8 years ago

@dmtroyer, @whit537 before I start a PR, are you guys cool with this design? There a few other ways to do it (hacking ng-route to accept an authenticatedRoute boolean property in a granular way, for example).

dmtroyer commented 8 years ago

This works for me. I recall reading about a more granular method using angular-ui-router, as well.

chadwhitacre commented 8 years ago

Works for me.

MatthewVita commented 8 years ago

PR here: https://github.com/saxifrage/cityasacampus/pull/381/commits