| .. | .. |
|---|
| 23 | 23 | }). |
|---|
| 24 | 24 | success(function(data, status, headers, config) { |
|---|
| 25 | 25 | 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); |
|---|
| 27 | 29 | $store.put('username', $scope.username); |
|---|
| 28 | 30 | $store.put('token', data.token); |
|---|
| 29 | 31 | $http.defaults.headers.common['X-SECURIS-TOKEN'] = data.token; |
|---|
| 30 | 32 | }). |
|---|
| 31 | 33 | 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); |
|---|
| 34 | 38 | } else { |
|---|
| 35 | 39 | console.error(data + " status: "+ status); |
|---|
| 36 | 40 | toaster.pop('error', $L.get('Unexpected Login error'), $L.get('Unexpected error HTTP ({0}) accessing to server. Contact with the administrator.', status), 5000); |
|---|