This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git


The following commit(s) were added to refs/heads/master by this push:
     new b83426a  store: set cookie to allow old UI work with Primate
b83426a is described below

commit b83426afcbdcdf9a1f97850713b1bd42613ac810
Author: Rohit Yadav <rohit.ya...@shapeblue.com>
AuthorDate: Wed Feb 19 01:15:32 2020 +0530

    store: set cookie to allow old UI work with Primate
    
    Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com>
---
 src/store/modules/user.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index f65215e..0ff1dd8 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -15,6 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
+import Cookies from 'js-cookie'
 import Vue from 'vue'
 import md5 from 'md5'
 import { login, logout, api } from '@/api'
@@ -82,7 +83,17 @@ const user = {
     Login ({ commit }, userInfo) {
       return new Promise((resolve, reject) => {
         login(userInfo).then(response => {
-          const result = response.loginresponse
+          const result = response.loginresponse || {}
+
+          Cookies.set('account', result.account)
+          Cookies.set('domainid', result.domainid)
+          Cookies.set('role', result.type)
+          Cookies.set('sessionkey', result.sessionkey)
+          Cookies.set('timezone', result.timezone)
+          Cookies.set('timezoneoffset', result.timezoneoffset)
+          Cookies.set('userfullname', result.firstname + ' ' + result.lastname)
+          Cookies.set('userid', result.userid)
+          Cookies.set('username', result.username)
 
           Vue.ls.set(ACCESS_TOKEN, result.sessionkey, 60 * 60 * 1000)
           commit('SET_TOKEN', result.sessionkey)

Reply via email to