OWL ITS + 탐지시스템(인터넷 진흥원)
wyu
2021-12-27 4cf0a657b1e55340caf9ed0e384e7acf7f5790ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
 
define(['app'], function (app) {
    app.factory('AuthSession', ['$http', '$window', '$log', '$rootScope', 'User',
        function ($http, $window, $log, $rootScope, User) {
            return {
                login: function (credentials) {
                    var loginJson = 'j_username=' + encodeURIComponent(credentials.account) +
                        '&j_password=' + encodeURIComponent(credentials.password) + '&rememberMe=' + credentials.rememberMe;
 
                    return $http.post("security/login", loginJson, {
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                        }
                    }).then(function (response) {
                        $log.debug("로그인 결과 : ", response);
                        return response.data;
                    });
                },
                logout: function () {
                    // logout from the server
                    $http.get('security/logout').success(function (response) {
                        $log.debug("로그아웃성공");
                        //  초기화
                        $rootScope.users = [];
                        $rootScope.user = undefined;
                        $rootScope.workspaces = [];
                        $rootScope.workIssueTypes = []
                        $rootScope.projects = [];
                        $rootScope.departments = null;
                        $rootScope.authorities = {};
                        $rootScope.currentDetailIssueId = null;
 
                        $rootScope.webSocket = {
                            socket : null,
                            client : null
                        };
 
                        // to get a new csrf token call the api
                        User.getUserSession({});
                        return response;
                    });
                }
            };
        }]);
});