appirio-tech-ng-auth

4.2.6 • Public • Published

ng-auth

GitHub version Build Status Coverage Status Dependency Status

Install

bower install appirio-tech-ng-auth=git@github.com:appirio-tech/ng-auth --save

Usage

Include source

<script src="/bower_components/appirio-tech-ng-auth/dist/main.js" type="text/javascript"></script>

Add dependency

'use strict'
 
dependencies = [
  'appirio-tech-ng-auth'
]
 
angular.module 'app'dependencies

Login via a controller

controller = -> ($scopeAuthService)
  onSuccess = ->
    console.log 'log in successful'
 
  onError = ->
    console.log 'log in failed'
 
  $scope.login = ->
    loginOptions =
      username: $scope.username
      password: $scope.password
      error: onError
      success: onSuccess
 
    AuthService.login loginOptions

Check if user is logged in

isLoggedIn = AuthService.isLoggedIn

Get current user

 
controller = -> ($scopeUserV3Service)
  vm = this
  scope.$watch UserV3Service.getCurrentUser->
    user = UserV3Service.getCurrentUser()
    vm.user = user if user

Readme

Keywords

none

Package Sidebar

Install

npm i appirio-tech-ng-auth

Weekly Downloads

13

Version

4.2.6

License

none

Last publish

Collaborators

  • tif
  • samsep
  • triangleil
  • aselbie
  • atran_vietnogi