Skip to content

Instantly share code, notes, and snippets.

@davidpp
Created July 25, 2014 01:56
Show Gist options
  • Select an option

  • Save davidpp/1113148abefca48d1ad0 to your computer and use it in GitHub Desktop.

Select an option

Save davidpp/1113148abefca48d1ad0 to your computer and use it in GitHub Desktop.
class SecurityService
@$inject:['$http','sessionService', 'api']
constructor:(@http, @session, @api) ->
login:(username, password) =>
@http.get "#{@api.base}/security/login/credentials/#{username}/#{password}"
.success (user)=>
@session.isAuthenticated = true
@session.user = user
.error (ex)=>
# process error
angular
.module 'app'
.service 'securityService', SecurityService
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment