Guest User

Untitled

a guest
Feb 13th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. <form class="form-signin" method="post" ng-submit="enter(loginData)">
  2.  
  3. <img src="/img/logo.png" class="img-card img-rounded">
  4. <input ng-model="loginData.username" ng-show="loaded" type="text" class="form-control" name="username" placeholder="Имя пользователя" required="" autofocus="">
  5. <input ng-model="loginData.password" placeholder="Пароль" ng-show="loaded" type="password" class="form-control" name="password" у required="">
  6. <div class="center"><select class="form-control btn-secondary" required id="dep0" style="cursor: pointer; ">
  7. <option value="" disabled selected>Выбрать предприятие</option>
  8. <option value="1">1</option>
  9. <option value="2">2</option>
  10. <option value="2">3</option>
  11. <option value="none">Без предприятия</option>
  12. </select>
  13. </div>
  14. <div class="text-center mgb-20" ng-hide="loaded">
  15. <i class="fa fa-spinner fa-spin fa-5x"></i>
  16. </div>
  17. <br><br>
  18. <button type="submit" ng-show="loaded" class="btn btn-lg btn-primary btn-block">Вход</button>
  19. </form>
  20.  
  21. e.enter = function(e) {
  22. var varlog;
  23. if ($("#dep0").val()== "none")
  24. {
  25.  
  26. varlog="";
  27. }
  28.  
  29. else {
  30.  
  31. varlog = $("#dep0").val();
  32. }
  33.  
  34. t({
  35. method: "POST",
  36. url: o.url("api") + "/oauth?format=json",
  37. withCredentials: !0,
  38. data: {
  39. UserName: varlog+e.username,
  40. Password: e.password
  41. }
  42.  
  43. UserName=*****&Password=*******
  44.  
  45. e.enter = function(e) {
  46. var varlog;
  47. if ($("#dep0").val()== "none")
  48. {
  49.  
  50. varlog="";
  51. }
  52.  
  53. else {
  54.  
  55. varlog = $("#dep0").val();
  56. }
  57.  
  58. t({
  59. method: "POST",
  60. url: o.url("api") + "/oauth?format=json",
  61. withCredentials: !0,
  62. data: {
  63. UserName: varlog+e.username,
  64. Password: e.password
  65. }
  66. }).success(function(e) {
  67. if (console.log("login:", e),
  68. null === e)
  69. return void r({
  70. message: "Неудалось выполнить запрос",
  71. classes: "alert-danger",
  72. position: "right"
  73. });
  74. e.ResponseStatus && e.ResponseStatus.ErrorCode && "AuthenticationException" == e.ResponseStatus.ErrorCode ? r({
  75. message: "Неправильный логин и/или пароль",
  76. classes: "alert-danger",
  77. position: "right"
  78. }) : t({
  79. method: "GET",
  80. url: o.url("api2") + "/sus/Groups",
  81. headers: {
  82. Token: e.Data.TokenId
  83. }
  84. }).then(function(t) {
  85. var n = [];
  86. angular.forEach(t.data.entities, function(e, t) {
  87. n.push(e.link.value)
  88. }),
  89. e.Data.EmployeeGroups = n,
  90. localStorage.authMethod = "plain",
  91. localStorage.userData = angular.toJson(e.Data),
  92. localStorage.userTimeZone ? location.assign("/") : location.assign("/#time")
  93. })
  94. }).error(function(e, t) {
  95. t >= 500 && t < 600 && r({
  96. message: "Сервер недоступен",
  97. classes: "alert-danger",
  98. position: "right",
  99. duration: 3500
  100. }),
  101. console.log("login error:", e, t)
  102. })
  103. }
Add Comment
Please, Sign In to add comment