auth.js 954 B

1
  1. "use strict";var auth=angular.module("authApp",["ngCookies","authctrl"]);angular.module("authctrl",["authsvc"]),angular.module("authsvc",[]),angular.module("authctrl").controller("authcontroller",["$scope","$cookieStore","identitysvc",function(t,e,u){t.identity=function(r){u.identity(r).then(function(u){var r=JSON.stringify(u),n=JSON.parse(r),s=n.status;if("200"==s){var a=n.data.user;if(angular.isUndefined(a.id));else{var o=a.id;window.sessionStorage.setItem("userId",o),window.sessionStorage.setItem("userNameToken",a.name),e.put("userObm",a),e.put("menuObm",n.data.menu),e.put("session",n.data.sessionId),t.username=a.name}}})}}]),auth.value("server",{host:"192.168.3.233",getUrl:function(t){return"http://"+this.host+":9002/services/auth/sso/"}}),angular.module("authsvc").factory("identitysvc",["$rootScope","$http","$q","$timeout","server",function(t,e,u,r,n){return{identity:function(t){return n.getUrl("user")+t,e.get(n.getUrl("user")+t)}}}]);