Skip to content

Instantly share code, notes, and snippets.

View Royedc4's full-sized avatar
👾
Working at PLUSTEAM HQ

Roy Calderón Royedc4

👾
Working at PLUSTEAM HQ
View GitHub Profile

Keybase proof

I hereby claim:

  • I am royedc4 on github.
  • I am roycalderon (https://keybase.io/roycalderon) on keybase.
  • I have a public key whose fingerprint is 9548 6F7F F778 4DFA D532 2EA9 DC34 A66E F784 A80D

To claim this, I am signing this object:

@Royedc4
Royedc4 / gist:9891e6f498737f5fd025
Created March 23, 2015 19:13
This shows an example of the app logic to manage authentication on angularjs
// AUTHENTICATION ON ANGULARJS
.run([
'$rootScope', 'AUTH_EVENTS', 'LoginService', 'logger', '$location'
($rootScope, AUTH_EVENTS, LoginService, logger, $location) ->
$rootScope.$on '$routeChangeStart', (event,next) ->
authorizedRoles = next.data.authorizedRoles
if !LoginService.isAuthorized(authorizedRoles)
event.preventDefault()
if LoginService.isAuthenticated()
# User is not a11owed