mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-03 21:52:31 +09:00
1 parent
6141e593cd
commit
7fcd57f72a
6 files changed
+15
-24
No files matched your search
@@ -20,11 +20,12 @@ one_xmlrpc: 'http://localhost:2633/RPC2'
|
||||
# Flow Server: use it if you have flow-server and fireedge on different servers
|
||||
oneflow_server: 'http://localhost:2474'
|
||||
|
||||
|
||||
|
||||
# life expiration time (minutes)
|
||||
session_expiration: 180
|
||||
|
||||
# life expiration time when use the check remember into login (minutes)
|
||||
session_remember_expiration: 3600
|
||||
|
||||
# minimum life expiration time (minutes)
|
||||
minimun_opennebula_expiration: 30
|
||||
|
||||
|
||||
@@ -88,12 +88,12 @@ const authApi = createApi({
|
||||
isLoginInProgress: withGroupSwitcher && !!token && !isOneAdmin,
|
||||
}
|
||||
},
|
||||
async onQueryStarted({ remember }, { queryFulfilled, dispatch }) {
|
||||
async onQueryStarted(_, { queryFulfilled, dispatch }) {
|
||||
try {
|
||||
const { data: queryData } = await queryFulfilled
|
||||
|
||||
if (queryData?.jwt) {
|
||||
storage(JWT_NAME, queryData?.jwt, remember)
|
||||
storage(JWT_NAME, queryData?.jwt)
|
||||
dispatch(dismissSnackbar({ dismissAll: true }))
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ const initial = {
|
||||
withGroupSwitcher: false,
|
||||
isLoading: false,
|
||||
isFixMenu: false,
|
||||
|
||||
notifications: [],
|
||||
}
|
||||
|
||||
|
||||
@@ -18,19 +18,11 @@ import root from 'window-or-global'
|
||||
/**
|
||||
* Save an item in the browser storage.
|
||||
*
|
||||
* @param {string} name
|
||||
* - Name of item in the storage
|
||||
* @param {string} data
|
||||
* - Data will be saved into storage
|
||||
* @param {boolean} keepData
|
||||
* - If `true`, save the data in local storage, instead of session storage
|
||||
* @param {string} name - Name of item in the storage
|
||||
* @param {string} data - The data will be saved into local storage
|
||||
*/
|
||||
export const storage = (name = '', data = '', keepData = false) => {
|
||||
if (name && data) {
|
||||
keepData
|
||||
? root?.localStorage?.setItem(name, data)
|
||||
: root?.sessionStorage?.setItem(name, data)
|
||||
}
|
||||
export const storage = (name = '', data = '') => {
|
||||
name && data && root?.localStorage?.setItem(name, data)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +35,6 @@ export const removeStoreData = (items = []) => {
|
||||
|
||||
itemsToRemove.forEach((item) => {
|
||||
root?.localStorage?.removeItem(item)
|
||||
root?.sessionStorage?.removeItem(item)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -51,13 +42,11 @@ export const removeStoreData = (items = []) => {
|
||||
* Looking for an item in the browser storage.
|
||||
*
|
||||
* @param {string} name - Name of item
|
||||
* @returns {object|string} Returns the item if found it
|
||||
* @returns {false|string} Returns the item if found it
|
||||
*/
|
||||
export const findStorageData = (name = '') => {
|
||||
if (name && root?.localStorage?.getItem(name)) {
|
||||
return root.localStorage.getItem(name)
|
||||
} else if (name && root?.sessionStorage?.getItem(name)) {
|
||||
return root.sessionStorage.getItem(name)
|
||||
} else return false
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ const setRes = (newRes = {}) => {
|
||||
*/
|
||||
const setDates = () => {
|
||||
limitToken = remember
|
||||
? appConfig.session__remember_expiration || defaultRememberSessionExpiration
|
||||
? appConfig.session_remember_expiration || defaultRememberSessionExpiration
|
||||
: appConfig.session_expiration || defaultSessionExpiration
|
||||
limitExpirationReuseToken =
|
||||
parseInt(appConfig.session_reuse_token_time, 10) ||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
* See the License for the specific language governing permissions and *
|
||||
* limitations under the License. *
|
||||
* ------------------------------------------------------------------------- */
|
||||
// eslint-disable-next-line node/no-deprecated-api
|
||||
const { parse } = require('url')
|
||||
const { Router } = require('express')
|
||||
const { renderToString } = require('react-dom/server')
|
||||
const root = require('window-or-global')
|
||||
@@ -42,8 +44,8 @@ const router = Router()
|
||||
|
||||
router.get('*', (req, res) => {
|
||||
const apps = Object.keys(defaultApps)
|
||||
const appName = req.url
|
||||
.split(/\//gi)
|
||||
const appName = parse(req.url)
|
||||
.pathname.split(/\//gi)
|
||||
.filter((sub) => sub?.length > 0)
|
||||
.find((resource) => apps.includes(resource))
|
||||
|
||||
|
||||
Reference in new issue
Block a user