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
|
// Disable the markers button and list
|
||||||
disableMarkerUI: false,
|
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.
|
// 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;
|
compactPlayerMarkers: boolean;
|
||||||
disableContextMenu: boolean;
|
disableContextMenu: boolean;
|
||||||
disableMarkerUI: boolean;
|
disableMarkerUI: boolean;
|
||||||
|
customLoginUrl: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type LiveAtlasUIElement = 'layers' | 'chat' | LiveAtlasSidebarSection;
|
export type LiveAtlasUIElement = 'layers' | 'chat' | LiveAtlasSidebarSection;
|
||||||
|
@ -204,9 +204,13 @@ export const actions: ActionTree<State, State> & Actions = {
|
|||||||
async [ActionTypes.LOGIN]({state, commit}, data: any): Promise<void> {
|
async [ActionTypes.LOGIN]({state, commit}, data: any): Promise<void> {
|
||||||
if(data) {
|
if(data) {
|
||||||
await state.currentMapProvider!.login(data);
|
await state.currentMapProvider!.login(data);
|
||||||
|
} else {
|
||||||
|
if(state.ui.customLoginUrl) {
|
||||||
|
window.location.href = state.ui.customLoginUrl;
|
||||||
} else {
|
} else {
|
||||||
commit(MutationTypes.SHOW_UI_MODAL, 'login');
|
commit(MutationTypes.SHOW_UI_MODAL, 'login');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async [ActionTypes.LOGOUT]({state}): Promise<void> {
|
async [ActionTypes.LOGOUT]({state}): Promise<void> {
|
||||||
|
@ -142,6 +142,10 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
state.ui.playersSearch = uiConfig.playersSearch;
|
state.ui.playersSearch = uiConfig.playersSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(typeof uiConfig.customLoginUrl === 'string') {
|
||||||
|
state.ui.customLoginUrl = uiConfig.customLoginUrl;
|
||||||
|
}
|
||||||
|
|
||||||
state.servers = config.servers;
|
state.servers = config.servers;
|
||||||
|
|
||||||
if(state.currentServer && !state.servers.has(state.currentServer.id)) {
|
if(state.currentServer && !state.servers.has(state.currentServer.id)) {
|
||||||
|
@ -88,6 +88,7 @@ export type State = {
|
|||||||
compactPlayerMarkers: boolean;
|
compactPlayerMarkers: boolean;
|
||||||
disableContextMenu: boolean;
|
disableContextMenu: boolean;
|
||||||
disableMarkerUI: boolean;
|
disableMarkerUI: boolean;
|
||||||
|
customLoginUrl: string | null;
|
||||||
|
|
||||||
screenWidth: number;
|
screenWidth: number;
|
||||||
screenHeight: number;
|
screenHeight: number;
|
||||||
@ -230,6 +231,7 @@ export const state: State = {
|
|||||||
compactPlayerMarkers: false,
|
compactPlayerMarkers: false,
|
||||||
disableContextMenu: false,
|
disableContextMenu: false,
|
||||||
disableMarkerUI: false,
|
disableMarkerUI: false,
|
||||||
|
customLoginUrl: null,
|
||||||
|
|
||||||
screenWidth: window.innerWidth,
|
screenWidth: window.innerWidth,
|
||||||
screenHeight: window.innerHeight,
|
screenHeight: window.innerHeight,
|
||||||
|
Loading…
Reference in New Issue
Block a user