Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. angular['module']('json', ['ngCookies'])['controller']('loginController', ['$http', '$scope', '$cookies', function(_0x30f6x1, _0x30f6x2, _0x30f6x3) {
  2. _0x30f6x2['credentials'] = {
  3. UserName: '',
  4. Password: ''
  5. };
  6. _0x30f6x2['error'] = {
  7. message: '',
  8. show: false
  9. };
  10. var _0x30f6x4 = _0x30f6x3['get']('OAuth2');
  11. if (_0x30f6x4) {
  12. window['location']['href'] = 'index.html'
  13. };
  14. _0x30f6x2['login'] = function() {
  15. _0x30f6x1['post']('/api/token', _0x30f6x2['credentials'])['then'](function(_0x30f6x5) {
  16. window['location']['href'] = 'index.html'
  17. }, function(_0x30f6x6) {
  18. _0x30f6x2['error']['message'] = 'Invalid Credentials.';
  19. _0x30f6x2['error']['show'] = true;
  20. console['log'](_0x30f6x6)
  21. })
  22. }
  23. }])['controller']('principalController', ['$http', '$scope', '$cookies', function(_0x30f6x1, _0x30f6x2, _0x30f6x3) {
  24. var _0x30f6x4 = _0x30f6x3['get']('OAuth2');
  25. if (_0x30f6x4) {
  26. _0x30f6x1['get']('/api/Account/', {
  27. headers: {
  28. "Bearer": _0x30f6x4
  29. }
  30. })['then'](function(_0x30f6x5) {
  31. _0x30f6x2['UserName'] = _0x30f6x5['data']['Name']
  32. }, function(_0x30f6x6) {
  33. _0x30f6x3['remove']('OAuth2');
  34. window['location']['href'] = 'login.html'
  35. })
  36. } else {
  37. window['location']['href'] = 'login.html'
  38. }
  39. }])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement