isite 2025.1.6 → 2025.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/security/site_files/html/login_modal.html +17 -17
- package/apps/security/site_files/js/index.js +255 -258
- package/apps/security/site_files/js/login.js +33 -33
- package/apps/security/site_files/js/logout.js +13 -13
- package/apps/security/site_files/js/register.js +18 -18
- package/isite_files/html/browser.html +1 -1
- package/lib/browser.js +48 -48
- package/lib/routing.js +1443 -1439
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
<div data-ng-controller="login" id="loginModal" class="modal" fixed>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<div class="modal-content">
|
|
3
|
+
<div class="modal-header">
|
|
4
|
+
<p class="bold font-22 text-center"><i class="fas fa-sign-in-alt"></i> ##word.security_login##</p>
|
|
5
|
+
<span class="close">×</span>
|
|
6
|
+
</div>
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
<div class="modal-body">
|
|
9
|
+
<p ng-show="busy" class="center"><i class="fas fa-spinner fa-pulse fa-3x fa-fw"></i></p>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
<form ng-hide="busy">
|
|
12
|
+
<i-control label="##word.security_user_email##" ng-model="userEmail" ng-keydown="tryLogin($event)"></i-control>
|
|
13
|
+
<i-control type="password" label="##word.security_user_password##" ng-model="userPassword" ng-keydown="tryLogin($event)"></i-control>
|
|
14
|
+
</form>
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
<p class="red">{{error}}</p>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="modal-footer center">
|
|
19
|
+
<i-button ng-hide="busy" type="signin" ng-click="login()" label="##word.security_login##"></i-button>
|
|
20
|
+
<i-button ng-hide="busy" type="close" onclick="site.hideModal('#loginModal')" label="##word.close##"></i-button>
|
|
21
|
+
</div>
|
|
21
22
|
</div>
|
|
22
|
-
</div>
|
|
23
23
|
</div>
|
|
24
24
|
<script x-import="security/login.js"></script>
|
|
@@ -1,278 +1,275 @@
|
|
|
1
|
-
app.controller(
|
|
1
|
+
app.controller('security', function ($scope, $http, $interval) {
|
|
2
|
+
$scope.loadAll = function () {
|
|
3
|
+
$http({
|
|
4
|
+
method: 'POST',
|
|
5
|
+
url: '/api/users/all',
|
|
6
|
+
data: {},
|
|
7
|
+
}).then(
|
|
8
|
+
function (response) {
|
|
9
|
+
if (response.data.done) {
|
|
10
|
+
$scope.list = response.data.users;
|
|
11
|
+
$scope.count = response.data.count;
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
function (err) {
|
|
15
|
+
$scope.error = err;
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
};
|
|
2
19
|
|
|
3
|
-
|
|
20
|
+
$scope.loadRoles = function () {
|
|
21
|
+
$http({
|
|
22
|
+
method: 'POST',
|
|
23
|
+
url: '/api/security/roles',
|
|
24
|
+
data: {},
|
|
25
|
+
}).then(
|
|
26
|
+
function (response) {
|
|
27
|
+
if (response.data.done) {
|
|
28
|
+
$scope.roles = response.data.roles;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
function (err) {
|
|
32
|
+
$scope.error = err;
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
4
36
|
|
|
5
|
-
$
|
|
6
|
-
method: "POST",
|
|
7
|
-
url: "/api/users/all",
|
|
8
|
-
data: {}
|
|
9
|
-
}).then(
|
|
10
|
-
function (response) {
|
|
11
|
-
if (response.data.done) {
|
|
12
|
-
$scope.list = response.data.users;
|
|
13
|
-
$scope.count = response.data.count;
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
function (err) {
|
|
17
|
-
$scope.error = err;
|
|
18
|
-
}
|
|
19
|
-
)
|
|
20
|
-
};
|
|
37
|
+
$scope.user = { profile: { image_url: '/images/user.png', files: [] }, permissions: [], roles: [] };
|
|
21
38
|
|
|
39
|
+
$scope.uploadImage = function (files) {
|
|
40
|
+
var fd = new FormData();
|
|
41
|
+
fd.append('fileToUpload', files[0]);
|
|
42
|
+
$http
|
|
43
|
+
.post('/api/user/upload/image', fd, {
|
|
44
|
+
withCredentials: !0,
|
|
45
|
+
headers: {
|
|
46
|
+
'Content-Type': undefined,
|
|
47
|
+
},
|
|
48
|
+
uploadEventHandlers: {
|
|
49
|
+
progress: function (e) {
|
|
50
|
+
$scope.uploadStatus = 'Uploading : ' + Math.round((e.loaded * 100) / e.total) + ' %';
|
|
51
|
+
if (e.loaded == e.total) {
|
|
52
|
+
$scope.uploadStatus = '100%';
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
transformRequest: angular.identity,
|
|
57
|
+
})
|
|
58
|
+
.then(
|
|
59
|
+
function (res) {
|
|
60
|
+
if (res.data && res.data.done) {
|
|
61
|
+
$scope.uploadStatus = 'File Uploaded';
|
|
62
|
+
$scope.user.profile.image_url = res.data.image_url;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
function (error) {
|
|
66
|
+
$scope.uploadStatus = error;
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
};
|
|
22
70
|
|
|
71
|
+
$scope.uploadFile = function (files) {
|
|
72
|
+
var fd = new FormData();
|
|
73
|
+
fd.append('fileToUpload', files[0]);
|
|
74
|
+
$http
|
|
75
|
+
.post('/api/user/upload/file', fd, {
|
|
76
|
+
withCredentials: !0,
|
|
77
|
+
headers: {
|
|
78
|
+
'Content-Type': undefined,
|
|
79
|
+
},
|
|
80
|
+
uploadEventHandlers: {
|
|
81
|
+
progress: function (e) {
|
|
82
|
+
$scope.fileStatus = 'Uploading : ' + Math.round((e.loaded * 100) / e.total) + ' %';
|
|
83
|
+
if (e.loaded == e.total) {
|
|
84
|
+
$scope.fileStatus = '100%';
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
transformRequest: angular.identity,
|
|
89
|
+
})
|
|
90
|
+
.then(
|
|
91
|
+
function (res) {
|
|
92
|
+
if (res.data && res.data.done) {
|
|
93
|
+
$scope.fileStatus = 'File Uploaded';
|
|
94
|
+
$scope.user.profile.files.push({
|
|
95
|
+
url: res.data.file_url,
|
|
96
|
+
name: $scope.fileName || res.data.file_name,
|
|
97
|
+
});
|
|
98
|
+
$scope.fileName = '';
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
function (error) {
|
|
102
|
+
$scope.fileStatus = error;
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
};
|
|
23
106
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if(response.data.done){
|
|
32
|
-
$scope.roles = response.data.roles;
|
|
107
|
+
$scope.deleteFile = function (file) {
|
|
108
|
+
for (let i = 0; i < $scope.user.profile.files.length; i++) {
|
|
109
|
+
let f = $scope.user.profile.files[i];
|
|
110
|
+
if (f.url === file.url) {
|
|
111
|
+
$scope.user.profile.files.splice(i, 1);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
33
114
|
}
|
|
34
|
-
|
|
35
|
-
function (err) {
|
|
36
|
-
$scope.error = err;
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
$scope.user = { profile: { image_url: '/images/user.png', files: [] }, permissions: [], roles: [] };
|
|
115
|
+
};
|
|
41
116
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
$http.post('/api/user/upload/image', fd, {
|
|
46
|
-
withCredentials: !0,
|
|
47
|
-
headers: {
|
|
48
|
-
'Content-Type': undefined
|
|
49
|
-
},
|
|
50
|
-
uploadEventHandlers: {
|
|
51
|
-
progress: function (e) {
|
|
52
|
-
$scope.uploadStatus = "Uploading : " + Math.round((e.loaded * 100 / e.total)) + " %";
|
|
53
|
-
if (e.loaded == e.total) {
|
|
54
|
-
$scope.uploadStatus = "100%";
|
|
55
|
-
}
|
|
117
|
+
$scope.addPermission = function () {
|
|
118
|
+
if ($scope.permission == '') {
|
|
119
|
+
return;
|
|
56
120
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
}, function (error) {
|
|
65
|
-
$scope.uploadStatus = error;
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
$scope.uploadFile = function (files) {
|
|
70
|
-
var fd = new FormData();
|
|
71
|
-
fd.append("fileToUpload", files[0]);
|
|
72
|
-
$http.post('/api/user/upload/file', fd, {
|
|
73
|
-
withCredentials: !0,
|
|
74
|
-
headers: {
|
|
75
|
-
'Content-Type': undefined
|
|
76
|
-
},
|
|
77
|
-
uploadEventHandlers: {
|
|
78
|
-
progress: function (e) {
|
|
79
|
-
$scope.fileStatus = "Uploading : " + Math.round((e.loaded * 100 / e.total)) + " %";
|
|
80
|
-
if (e.loaded == e.total) {
|
|
81
|
-
$scope.fileStatus = "100%";
|
|
82
|
-
}
|
|
121
|
+
for (let i = 0; i < $scope.user.permissions.length; i++) {
|
|
122
|
+
let p = $scope.user.permissions[i];
|
|
123
|
+
if (p === $scope.permission) {
|
|
124
|
+
$scope.permission = '';
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
83
127
|
}
|
|
84
|
-
|
|
85
|
-
transformRequest: angular.identity
|
|
86
|
-
}).then(function (res) {
|
|
87
|
-
if (res.data && res.data.done) {
|
|
88
|
-
$scope.fileStatus = "File Uploaded";
|
|
89
|
-
$scope.user.profile.files.push({
|
|
90
|
-
url: res.data.file_url,
|
|
91
|
-
name: $scope.fileName || res.data.file_name
|
|
92
|
-
});
|
|
93
|
-
$scope.fileName = '';
|
|
94
|
-
}
|
|
95
|
-
}, function (error) {
|
|
96
|
-
$scope.fileStatus = error;
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
$scope.deleteFile = function (file) {
|
|
101
|
-
for (let i = 0; i < $scope.user.profile.files.length; i++) {
|
|
102
|
-
let f = $scope.user.profile.files[i];
|
|
103
|
-
if (f.url === file.url) {
|
|
104
|
-
$scope.user.profile.files.splice(i, 1);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
$scope.addPermission = function () {
|
|
111
|
-
|
|
112
|
-
if ($scope.permission == '') {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
for (let i = 0; i < $scope.user.permissions.length; i++) {
|
|
116
|
-
let p = $scope.user.permissions[i];
|
|
117
|
-
if (p === $scope.permission) {
|
|
128
|
+
$scope.user.permissions.push($scope.permission);
|
|
118
129
|
$scope.permission = '';
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
$scope.user.permissions.push($scope.permission);
|
|
123
|
-
$scope.permission = '';
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
$scope.addRole = function () {
|
|
130
|
+
};
|
|
127
131
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
$scope.addRole = function () {
|
|
133
|
+
if ($scope.role === undefined) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
let role = site.fromJson($scope.role);
|
|
132
137
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
for (let i = 0; i < $scope.user.roles.length; i++) {
|
|
139
|
+
let r = $scope.user.roles[i];
|
|
140
|
+
if (r.name === role.name) {
|
|
141
|
+
$scope.role = {};
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
$scope.user.roles.push({
|
|
146
|
+
name: role.name,
|
|
147
|
+
en: role.en,
|
|
148
|
+
ar: role.ar,
|
|
149
|
+
});
|
|
136
150
|
$scope.role = {};
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
$scope.user.roles.push({
|
|
141
|
-
name : role.name,
|
|
142
|
-
en : role.en,
|
|
143
|
-
ar : role.ar
|
|
144
|
-
});
|
|
145
|
-
$scope.role = {};
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
$scope.deletePermission = function (permission) {
|
|
149
|
-
for (let i = 0; i < $scope.user.permissions.length; i++) {
|
|
150
|
-
let p = $scope.user.permissions[i];
|
|
151
|
-
if (p === permission) {
|
|
152
|
-
$scope.user.permissions.splice(i, 1)
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
$scope.deleteRole = function (role) {
|
|
158
|
-
for (let i = 0; i < $scope.user.roles.length; i++) {
|
|
159
|
-
let r = $scope.user.roles[i];
|
|
160
|
-
if (r.name === role.name) {
|
|
161
|
-
$scope.user.roles.splice(i, 1)
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
};
|
|
151
|
+
};
|
|
165
152
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
};
|
|
173
|
-
$scope.add = function () {
|
|
174
|
-
$scope.busy = !0;
|
|
175
|
-
$http({
|
|
176
|
-
method: "POST",
|
|
177
|
-
url: "/api/user/add",
|
|
178
|
-
data: $scope.user
|
|
179
|
-
}).then(
|
|
180
|
-
function (response) {
|
|
181
|
-
$scope.busy = !1;
|
|
182
|
-
if (response.data.done) {
|
|
183
|
-
site.hideModal('#addUserModal');
|
|
184
|
-
$scope.loadAll();
|
|
185
|
-
} else {
|
|
186
|
-
$scope.error = response.data.error;
|
|
153
|
+
$scope.deletePermission = function (permission) {
|
|
154
|
+
for (let i = 0; i < $scope.user.permissions.length; i++) {
|
|
155
|
+
let p = $scope.user.permissions[i];
|
|
156
|
+
if (p === permission) {
|
|
157
|
+
$scope.user.permissions.splice(i, 1);
|
|
158
|
+
}
|
|
187
159
|
}
|
|
188
|
-
|
|
189
|
-
function (err) {
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
)
|
|
193
|
-
};
|
|
160
|
+
};
|
|
194
161
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
$scope.busy = !0;
|
|
202
|
-
$http({
|
|
203
|
-
method: "POST",
|
|
204
|
-
url: "/api/user/update",
|
|
205
|
-
data: $scope.user
|
|
206
|
-
}).then(
|
|
207
|
-
function (response) {
|
|
208
|
-
$scope.busy = !1;
|
|
209
|
-
if (response.data.done) {
|
|
210
|
-
site.hideModal('#updateUserModal');
|
|
211
|
-
site.hideModal('#viewUserModal')
|
|
212
|
-
$scope.loadAll();
|
|
213
|
-
} else {
|
|
214
|
-
$scope.error = response.data.error;
|
|
162
|
+
$scope.deleteRole = function (role) {
|
|
163
|
+
for (let i = 0; i < $scope.user.roles.length; i++) {
|
|
164
|
+
let r = $scope.user.roles[i];
|
|
165
|
+
if (r.name === role.name) {
|
|
166
|
+
$scope.user.roles.splice(i, 1);
|
|
167
|
+
}
|
|
215
168
|
}
|
|
216
|
-
|
|
217
|
-
function (err) {
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
)
|
|
221
|
-
};
|
|
169
|
+
};
|
|
222
170
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
171
|
+
$scope.newuser = function () {
|
|
172
|
+
$scope.permissionEditor = !1;
|
|
173
|
+
$scope.imageEditor = !1;
|
|
174
|
+
$scope.fileEditor = !1;
|
|
175
|
+
$scope.user = { profile: { image_url: '/images/user.png', files: [] }, permissions: [], roles: [] };
|
|
176
|
+
site.showModal('#addUserModal');
|
|
177
|
+
};
|
|
178
|
+
$scope.add = function () {
|
|
179
|
+
$scope.busy = !0;
|
|
180
|
+
$http({
|
|
181
|
+
method: 'POST',
|
|
182
|
+
url: '/api/user/add',
|
|
183
|
+
data: $scope.user,
|
|
184
|
+
}).then(
|
|
185
|
+
function (response) {
|
|
186
|
+
$scope.busy = !1;
|
|
187
|
+
if (response.data.done) {
|
|
188
|
+
site.hideModal('#addUserModal');
|
|
189
|
+
$scope.loadAll();
|
|
190
|
+
} else {
|
|
191
|
+
$scope.error = response.data.error;
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
function (err) {}
|
|
195
|
+
);
|
|
196
|
+
};
|
|
228
197
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
$scope.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
$scope.busy = !
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
198
|
+
$scope.edit = function (user) {
|
|
199
|
+
$scope.view(user);
|
|
200
|
+
$scope.user = { profile: { image_url: '/images/user.png', files: [] }, permissions: [], roles: [] };
|
|
201
|
+
site.showModal('#updateUserModal');
|
|
202
|
+
};
|
|
203
|
+
$scope.update = function () {
|
|
204
|
+
$scope.busy = !0;
|
|
205
|
+
$http({
|
|
206
|
+
method: 'POST',
|
|
207
|
+
url: '/api/user/update',
|
|
208
|
+
data: $scope.user,
|
|
209
|
+
}).then(
|
|
210
|
+
function (response) {
|
|
211
|
+
$scope.busy = !1;
|
|
212
|
+
if (response.data.done) {
|
|
213
|
+
site.hideModal('#updateUserModal');
|
|
214
|
+
site.hideModal('#viewUserModal');
|
|
215
|
+
$scope.loadAll();
|
|
216
|
+
} else {
|
|
217
|
+
$scope.error = response.data.error;
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
function (err) {}
|
|
221
|
+
);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
$scope.remove = function (user) {
|
|
225
|
+
$scope.view(user);
|
|
226
|
+
$scope.user = { profile: { image_url: '/images/user.png', files: [] }, permissions: [], roles: [] };
|
|
227
|
+
site.showModal('#deleteUserModal');
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
$scope.view = function (user) {
|
|
231
|
+
$scope.busy = !0;
|
|
232
|
+
$http({
|
|
233
|
+
method: 'POST',
|
|
234
|
+
url: '/api/user/view',
|
|
235
|
+
data: { id: user.id },
|
|
236
|
+
}).then(
|
|
237
|
+
function (response) {
|
|
238
|
+
$scope.busy = !1;
|
|
239
|
+
if (response.data.done) {
|
|
240
|
+
$scope.user = response.data.doc;
|
|
241
|
+
} else {
|
|
242
|
+
$scope.error = response.data.error;
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
function (err) {}
|
|
246
|
+
);
|
|
247
|
+
};
|
|
248
|
+
$scope.details = function (user) {
|
|
249
|
+
$scope.view(user);
|
|
250
|
+
$scope.user = { profile: { image_url: '/images/user.png', files: [] }, permissions: [], roles: [] };
|
|
251
|
+
site.showModal('#viewUserModal');
|
|
252
|
+
};
|
|
253
|
+
$scope.delete = function () {
|
|
254
|
+
$scope.busy = !0;
|
|
255
|
+
$http({
|
|
256
|
+
method: 'POST',
|
|
257
|
+
url: '/api/user/delete',
|
|
258
|
+
data: { id: $scope.user.id, name: $scope.user.name },
|
|
259
|
+
}).then(
|
|
260
|
+
function (response) {
|
|
261
|
+
$scope.busy = !1;
|
|
262
|
+
if (response.data.done) {
|
|
263
|
+
site.hideModal('#deleteUserModal');
|
|
264
|
+
site.hideModal('#viewUserModal');
|
|
265
|
+
$scope.loadAll();
|
|
266
|
+
} else {
|
|
267
|
+
$scope.error = response.data.error;
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
function (err) {}
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
$scope.loadAll();
|
|
274
|
+
$scope.loadRoles();
|
|
278
275
|
});
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
app.controller('login', function ($scope, $http) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
$scope.login = function () {
|
|
10
|
-
$scope.error = '';
|
|
11
|
-
$scope.busy = !0;
|
|
12
|
-
$http({
|
|
13
|
-
method: 'POST',
|
|
14
|
-
url: '/api/user/login',
|
|
15
|
-
data: {
|
|
16
|
-
$encript: '123',
|
|
17
|
-
email: site.to123($scope.userEmail),
|
|
18
|
-
password: site.to123($scope.userPassword),
|
|
19
|
-
},
|
|
20
|
-
}).then(
|
|
21
|
-
function (response) {
|
|
22
|
-
if (response.data.error) {
|
|
23
|
-
$scope.error = response.data.error;
|
|
24
|
-
}
|
|
25
|
-
if (response.data.done) {
|
|
26
|
-
window.location.reload(!0);
|
|
2
|
+
$scope.busy = !1;
|
|
3
|
+
$scope.tryLogin = function (ev) {
|
|
4
|
+
if (ev.which == 13) {
|
|
5
|
+
$scope.login();
|
|
27
6
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
$scope.
|
|
32
|
-
$scope.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
$scope.login = function () {
|
|
10
|
+
$scope.error = '';
|
|
11
|
+
$scope.busy = !0;
|
|
12
|
+
$http({
|
|
13
|
+
method: 'POST',
|
|
14
|
+
url: '/api/user/login',
|
|
15
|
+
data: {
|
|
16
|
+
$encript: '123',
|
|
17
|
+
email: site.to123($scope.userEmail),
|
|
18
|
+
password: site.to123($scope.userPassword),
|
|
19
|
+
},
|
|
20
|
+
}).then(
|
|
21
|
+
function (response) {
|
|
22
|
+
if (response.data.error) {
|
|
23
|
+
$scope.error = response.data.error;
|
|
24
|
+
}
|
|
25
|
+
if (response.data.done) {
|
|
26
|
+
window.location.reload(!0);
|
|
27
|
+
}
|
|
28
|
+
$scope.busy = !1;
|
|
29
|
+
},
|
|
30
|
+
function (err) {
|
|
31
|
+
$scope.busy = !1;
|
|
32
|
+
$scope.error = err;
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
36
|
});
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
app.controller('logout', function ($scope, $http) {
|
|
2
|
-
|
|
3
2
|
$scope.busy = !1;
|
|
4
|
-
|
|
5
3
|
|
|
6
4
|
$scope.logout = function () {
|
|
7
5
|
$scope.error = '';
|
|
8
6
|
$scope.busy = !0;
|
|
9
7
|
|
|
10
|
-
$http.post('/api/user/logout').then(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
$http.post('/api/user/logout').then(
|
|
9
|
+
function (response) {
|
|
10
|
+
if (response.data.done) {
|
|
11
|
+
window.location.href = '/';
|
|
12
|
+
} else {
|
|
13
|
+
$scope.error = response.data.error;
|
|
14
|
+
$scope.busy = !1;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
function (error) {
|
|
16
18
|
$scope.busy = !1;
|
|
19
|
+
$scope.error = error;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
$scope.busy = !1;
|
|
20
|
-
$scope.error = error;
|
|
21
|
-
});
|
|
21
|
+
);
|
|
22
22
|
};
|
|
23
|
-
});
|
|
23
|
+
});
|