| 255 | }, |
| 256 | |
| 257 | OauthLogin ({ commit }, userInfo) { |
| 258 | return new Promise((resolve, reject) => { |
| 259 | oauthlogin(userInfo).then(response => { |
| 260 | const result = response.loginresponse || {} |
| 261 | Cookies.set('account', result.account, { expires: 1 }) |
| 262 | Cookies.set('domainid', result.domainid, { expires: 1 }) |
| 263 | Cookies.set('role', result.type, { expires: 1 }) |
| 264 | Cookies.set('timezone', result.timezone, { expires: 1 }) |
| 265 | Cookies.set('timezoneoffset', result.timezoneoffset, { expires: 1 }) |
| 266 | Cookies.set('userfullname', result.firstname + ' ' + result.lastname, { expires: 1 }) |
| 267 | Cookies.set('userid', result.userid, { expires: 1 }) |
| 268 | Cookies.set('username', result.username, { expires: 1 }) |
| 269 | vueProps.$localStorage.set(ACCESS_TOKEN, result.sessionkey, 24 * 60 * 60 * 1000) |
| 270 | commit('SET_TOKEN', result.sessionkey) |
| 271 | commit('SET_TIMEZONE_OFFSET', result.timezoneoffset) |
| 272 | |
| 273 | const cachedUseBrowserTimezone = vueProps.$localStorage.get(USE_BROWSER_TIMEZONE, false) |
| 274 | commit('SET_USE_BROWSER_TIMEZONE', cachedUseBrowserTimezone) |
| 275 | const darkMode = vueProps.$localStorage.get(DARK_MODE, false) |
| 276 | commit('SET_DARK_MODE', darkMode) |
| 277 | const cachedCustomColumns = vueProps.$localStorage.get(CUSTOM_COLUMNS, {}) |
| 278 | commit('SET_CUSTOM_COLUMNS', cachedCustomColumns) |
| 279 | |
| 280 | commit('SET_APIS', {}) |
| 281 | commit('SET_NAME', '') |
| 282 | commit('SET_AVATAR', '') |
| 283 | commit('SET_INFO', {}) |
| 284 | commit('SET_PROJECT', {}) |
| 285 | commit('SET_HEADER_NOTICES', []) |
| 286 | commit('SET_FEATURES', {}) |
| 287 | commit('SET_LDAP', {}) |
| 288 | commit('SET_CLOUDIAN', {}) |
| 289 | commit('SET_DOMAIN_STORE', {}) |
| 290 | commit('SET_LOGOUT_FLAG', false) |
| 291 | commit('SET_2FA_ENABLED', (result.is2faenabled === 'true')) |
| 292 | commit('SET_2FA_PROVIDER', result.providerfor2fa) |
| 293 | commit('SET_2FA_ISSUER', result.issuerfor2fa) |
| 294 | commit('SET_LOGIN_FLAG', false) |
| 295 | if (result && result.managementserverid) { |
| 296 | commit('SET_MS_ID', result.managementserverid) |
| 297 | } |
| 298 | const latestVersion = vueProps.$localStorage.get(LATEST_CS_VERSION, { version: '', fetchedTs: 0 }) |
| 299 | commit('SET_LATEST_VERSION', latestVersion) |
| 300 | notification.destroy() |
| 301 | |
| 302 | resolve() |
| 303 | }).catch(error => { |
| 304 | reject(error) |
| 305 | }) |
| 306 | }) |
| 307 | }, |
| 308 | |
| 309 | GetInfo ({ commit }, switchDomain) { |
| 310 | return new Promise((resolve, reject) => { |