rsanchez
2014-10-16 4d18a46ee3ada751517f9bf767d5057a3bf5eb9e
securis/src/main/resources/static/js/login.js
....@@ -23,14 +23,18 @@
2323 }).
2424 success(function(data, status, headers, config) {
2525 toaster.pop('success', $L.get('Login successful'), $L.get('User {0} has logged in application', $scope.username), 1500);
26
- $location.path('/licenses');
26
+ var location = $store.get('location') || '/licenses';
27
+
28
+ $location.path(location);
2729 $store.put('username', $scope.username);
2830 $store.put('token', data.token);
2931 $http.defaults.headers.common['X-SECURIS-TOKEN'] = data.token;
3032 }).
3133 error(function(data, status, headers, config) {
32
- if (status === 403 /* forbidden */) {
33
- toaster.pop('error', $L.get('Login error'), $L.get('Invalid credentials'), 3000);
34
+ if (status === 403 /* forbidden */ || status === 401 /* unauthorized */) {
35
+ toaster.pop('error', $L.get('Login error'), $L.get('Invalid credentials'), 2000);
36
+ } else if (status === 418 /* Teapot */) {
37
+ toaster.pop('error', $L.get('Login error'), $L.get(headers['X-SECURIS-ERROR-MSG']), 2000);
3438 } else {
3539 console.error(data + " status: "+ status);
3640 toaster.pop('error', $L.get('Unexpected Login error'), $L.get('Unexpected error HTTP ({0}) accessing to server. Contact with the administrator.', status), 5000);