Add option for custom login URL. Fixes #381.
This commit is contained in:
parent
46c4e6d3eb
commit
e37ed130f5
@ -180,6 +180,10 @@
|
||||
|
||||
// Disable the markers button and list
|
||||
disableMarkerUI: false,
|
||||
|
||||
// Custom URL to redirect to when logging in is required
|
||||
// This URL will need to handle the login process and redirect users back to LiveAtlas
|
||||
customLoginUrl: null
|
||||
},
|
||||
|
||||
// Config version. Do not modify.
|
||||
|
1
src/index.d.ts
vendored
1
src/index.d.ts
vendored
@ -126,6 +126,7 @@ interface LiveAtlasUIConfig {
|
||||
compactPlayerMarkers: boolean;
|
||||
disableContextMenu: boolean;
|
||||
disableMarkerUI: boolean;
|
||||
customLoginUrl: string | null;
|
||||
}
|
||||
|
||||
export type LiveAtlasUIElement = 'layers' | 'chat' | LiveAtlasSidebarSection;
|
||||
|
@ -205,7 +205,11 @@ export const actions: ActionTree<State, State> & Actions = {
|
||||
if(data) {
|
||||
await state.currentMapProvider!.login(data);
|
||||
} else {
|
||||
commit(MutationTypes.SHOW_UI_MODAL, 'login');
|
||||
if(state.ui.customLoginUrl) {
|
||||
window.location.href = state.ui.customLoginUrl;
|
||||
} else {
|
||||
commit(MutationTypes.SHOW_UI_MODAL, 'login');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -142,6 +142,10 @@ export const mutations: MutationTree<State> & Mutations = {
|
||||
state.ui.playersSearch = uiConfig.playersSearch;
|
||||
}
|
||||
|
||||
if(typeof uiConfig.customLoginUrl === 'string') {
|
||||
state.ui.customLoginUrl = uiConfig.customLoginUrl;
|
||||
}
|
||||
|
||||
state.servers = config.servers;
|
||||
|
||||
if(state.currentServer && !state.servers.has(state.currentServer.id)) {
|
||||
|
@ -88,6 +88,7 @@ export type State = {
|
||||
compactPlayerMarkers: boolean;
|
||||
disableContextMenu: boolean;
|
||||
disableMarkerUI: boolean;
|
||||
customLoginUrl: string | null;
|
||||
|
||||
screenWidth: number;
|
||||
screenHeight: number;
|
||||
@ -230,6 +231,7 @@ export const state: State = {
|
||||
compactPlayerMarkers: false,
|
||||
disableContextMenu: false,
|
||||
disableMarkerUI: false,
|
||||
customLoginUrl: null,
|
||||
|
||||
screenWidth: window.innerWidth,
|
||||
screenHeight: window.innerHeight,
|
||||
|
Loading…
Reference in New Issue
Block a user