Skip to content

Instantly share code, notes, and snippets.

@gnesher
Created May 8, 2013 16:21
Show Gist options
  • Save gnesher/5541620 to your computer and use it in GitHub Desktop.
Save gnesher/5541620 to your computer and use it in GitHub Desktop.
window.WebApp.factory('loginService', ['$rootScope', 'OAuth', '$location', 'cookies', ($rootScope, OAuth, $location, cookies) ->
@refresh_token = cookies.get('refresh_token')
@user_id = cookies.get('user_id')
# No user cradentials, redirect to login
if (@refresh_token == null or @user_id == null)
$location.path('/login')
User = {}
return User
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment