From 4d18a46ee3ada751517f9bf767d5057a3bf5eb9e Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Thu, 16 Oct 2014 18:16:33 +0000
Subject: [PATCH] #2021 feature - Added Pack management (in Beta) 

---
 securis/src/main/resources/static/js/login.js |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/securis/src/main/resources/static/js/login.js b/securis/src/main/resources/static/js/login.js
index 704bdc3..8051120 100644
--- a/securis/src/main/resources/static/js/login.js
+++ b/securis/src/main/resources/static/js/login.js
@@ -23,14 +23,18 @@
 			}).
 			  success(function(data, status, headers, config) {
 				  toaster.pop('success', $L.get('Login successful'), $L.get('User {0} has logged in application', $scope.username), 1500);
-				  $location.path('/licenses');
+				  var location = $store.get('location') || '/licenses';
+
+				  $location.path(location);
 				  $store.put('username', $scope.username);
 				  $store.put('token', data.token);
 				  $http.defaults.headers.common['X-SECURIS-TOKEN'] = data.token; 
 			  }).
 			  error(function(data, status, headers, config) {
-				if (status === 403 /* forbidden */) {
-					toaster.pop('error', $L.get('Login error'), $L.get('Invalid credentials'), 3000);
+				if (status === 403 /* forbidden */ || status === 401 /* unauthorized */) {
+					toaster.pop('error', $L.get('Login error'), $L.get('Invalid credentials'), 2000);
+				} else if (status === 418 /* Teapot */) {
+					toaster.pop('error', $L.get('Login error'), $L.get(headers['X-SECURIS-ERROR-MSG']), 2000);
 				} else {
 					console.error(data + " status: "+ status);
 					toaster.pop('error', $L.get('Unexpected Login error'), $L.get('Unexpected error HTTP ({0}) accessing to server. Contact with the administrator.', status), 5000);

--
Gitblit v1.3.2