You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/02/19 05:40:19 UTC

[cloudstack-primate] branch master updated (8498821 -> 6927504)

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

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


    from 8498821  store: remove set cookies on logout
     new f499f2e  login: fix unhandled promise issue
     new 6927504  permission: fix cookie handling to allow saml to work

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/permission.js         |  5 +++++
 src/store/modules/user.js | 22 +++++++++++-----------
 src/views/auth/Login.vue  |  2 +-
 3 files changed, 17 insertions(+), 12 deletions(-)


[cloudstack-primate] 01/02: login: fix unhandled promise issue

Posted by ro...@apache.org.
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

commit f499f2e35faf5728112dee9284715c99047465e8
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Wed Feb 19 10:53:47 2020 +0530

    login: fix unhandled promise issue
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 src/views/auth/Login.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/views/auth/Login.vue b/src/views/auth/Login.vue
index c64c38b..1bc6ec0 100644
--- a/src/views/auth/Login.vue
+++ b/src/views/auth/Login.vue
@@ -174,8 +174,8 @@ export default {
       })
     },
     loginSuccess (res) {
-      this.$router.push({ name: 'dashboard' })
       this.$message.loading('Login Successful. Discovering Features...', 5)
+      this.$router.push({ path: '/dashboard' }).catch(() => {})
     },
     requestFailed (err) {
       if (err && err.response && err.response.data && err.response.data.loginresponse) {


[cloudstack-primate] 02/02: permission: fix cookie handling to allow saml to work

Posted by ro...@apache.org.
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

commit 6927504e40479ec971da45d0218d245700f64616
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Wed Feb 19 11:09:44 2020 +0530

    permission: fix cookie handling to allow saml to work
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 src/permission.js         |  5 +++++
 src/store/modules/user.js | 22 +++++++++++-----------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/permission.js b/src/permission.js
index 04e0925..3216a4d 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -15,6 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
+import Cookies from 'js-cookie'
 import Vue from 'vue'
 import router from './router'
 import store from './store'
@@ -33,6 +34,10 @@ router.beforeEach((to, from, next) => {
   // start progress bar
   NProgress.start()
   to.meta && (typeof to.meta.title !== 'undefined' && setDocumentTitle(`${to.meta.title} - ${domTitle}`))
+  const sessionKeyCookie = Cookies.get('sessionkey')
+  if (sessionKeyCookie && !Vue.ls.get(ACCESS_TOKEN)) {
+    Vue.ls.set(ACCESS_TOKEN, sessionKeyCookie, 24 * 60 * 60 * 1000)
+  }
   if (Vue.ls.get(ACCESS_TOKEN)) {
     if (to.path === '/user/login') {
       next({ path: '/dashboard' })
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index be0e963..b2482a4 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -85,17 +85,17 @@ const user = {
         login(userInfo).then(response => {
           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)
+          Cookies.set('account', result.account, { expires: 1 })
+          Cookies.set('domainid', result.domainid, { expires: 1 })
+          Cookies.set('role', result.type, { expires: 1 })
+          Cookies.set('sessionkey', result.sessionkey, { expires: 1 })
+          Cookies.set('timezone', result.timezone, { expires: 1 })
+          Cookies.set('timezoneoffset', result.timezoneoffset, { expires: 1 })
+          Cookies.set('userfullname', result.firstname + ' ' + result.lastname, { expires: 1 })
+          Cookies.set('userid', result.userid, { expires: 1 })
+          Cookies.set('username', result.username, { expires: 1 })
+
+          Vue.ls.set(ACCESS_TOKEN, result.sessionkey, 24 * 60 * 60 * 1000)
           commit('SET_TOKEN', result.sessionkey)
           commit('SET_PROJECT', {})
           commit('SET_ASYNC_JOB_IDS', [])