[Kimchi-devel] [PATCH V3 1/4] Add roles into cookie

wenwang at linux.vnet.ibm.com wenwang at linux.vnet.ibm.com
Tue Jul 22 09:51:24 UTC 2014


From: Wen Wang <wenwang at linux.vnet.ibm.com>

V1 -> V2:
This patch add "roles" parameter into cookie instead of each tab's
mode(Aline)

This patch add each tab's mode into cookie

Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.login.js |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/ui/js/src/kimchi.login.js b/ui/js/src/kimchi.login.js
index 72d2ee3..b20f0b0 100644
--- a/ui/js/src/kimchi.login.js
+++ b/ui/js/src/kimchi.login.js
@@ -36,8 +36,8 @@ kimchi.login_main = function() {
     var loginButton = $('#btn-login');
 
     var login = function(event) {
-        $("#login").hide()
-        $("#logging").show()
+        $("#login").hide();
+        $("#logging").show();
 
         var userName = userNameBox.val();
         userName && kimchi.user.setUserName(userName);
@@ -50,18 +50,20 @@ kimchi.login_main = function() {
             var query = window.location.search;
             var next  = /.*next=(.*?)(&|$)/g.exec(query);
             if (next) {
-                var next_url = decodeURIComponent(next[1])
+                var next_url = decodeURIComponent(next[1]);
             }
             else {
                 var lastPage = kimchi.cookie.get('lastPage');
-                var next_url = lastPage ? lastPage.replace(/\"/g,'') : "/"
+                var next_url = lastPage ? lastPage.replace(/\"/g,'') : "/";
             }
+            var next_url = lastPage ? lastPage.replace(/\"/g,'') : "/";
+            kimchi.cookie.set('roles',JSON.stringify(data.roles), 365);
             window.location.replace(next_url)
         }, function() {
-            $("#messUserPass").show()
+            $("#messUserPass").show();
             $("#messSession").hide();
-            $("#logging").hide()
-            $("#login").show()
+            $("#logging").hide();
+            $("#login").show();
         });
 
         return false;
-- 
1.7.1




More information about the Kimchi-devel mailing list