signin.component.js 745 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. angular
  3. .module('app')
  4. .component('signin', {
  5. templateUrl: '/resources/signin/signin.component.html',
  6. controller: ['$scope', '$location', 'cms', function ($scope, $location, cms) {
  7. Object.assign($scope, {
  8. login: user => {
  9. cms.Authenticate({
  10. grant_type: 'password',
  11. client_id: 'cms',
  12. username: user.username,
  13. password: user.password,
  14. }).then(
  15. auth => {
  16. $location.path('/a/dashboard')
  17. },
  18. error => {
  19. console.log('auth-error', error)
  20. })
  21. },
  22. user: {
  23. password: 123456789,
  24. username: 'portal@portal',
  25. }
  26. })
  27. }]
  28. });