add option to prompt for a validation password when initializing admin user (#2302)
This commit is contained in:
@@ -256,7 +256,11 @@ const baseFetch = <T>(
|
||||
}
|
||||
const loginUrl = `${globalThis.location.origin}/signin`
|
||||
bodyJson.then((data: ResponseError) => {
|
||||
if (data.code === 'not_setup' && IS_CE_EDITION)
|
||||
if (data.code === 'init_validate_failed' && IS_CE_EDITION)
|
||||
Toast.notify({ type: 'error', message: data.message, duration: 4000 })
|
||||
else if (data.code === 'not_init_validated' && IS_CE_EDITION)
|
||||
globalThis.location.href = `${globalThis.location.origin}/init`
|
||||
else if (data.code === 'not_setup' && IS_CE_EDITION)
|
||||
globalThis.location.href = `${globalThis.location.origin}/install`
|
||||
else if (location.pathname !== '/signin' || !IS_CE_EDITION)
|
||||
globalThis.location.href = loginUrl
|
||||
|
@@ -9,6 +9,7 @@ import type {
|
||||
FileUploadConfigResponse,
|
||||
ICurrentWorkspace,
|
||||
IWorkspace,
|
||||
InitValidateStatusResponse,
|
||||
InvitationResponse,
|
||||
LangGeniusVersionResponse,
|
||||
Member,
|
||||
@@ -42,6 +43,14 @@ export const setup: Fetcher<CommonResponse, { body: Record<string, any> }> = ({
|
||||
return post<CommonResponse>('/setup', { body })
|
||||
}
|
||||
|
||||
export const initValidate: Fetcher<CommonResponse, { body: Record<string, any> }> = ({ body }) => {
|
||||
return post<CommonResponse>('/init', { body })
|
||||
}
|
||||
|
||||
export const fetchInitValidateStatus = () => {
|
||||
return get<InitValidateStatusResponse>('/init')
|
||||
}
|
||||
|
||||
export const fetchSetupStatus = () => {
|
||||
return get<SetupStatusResponse>('/setup')
|
||||
}
|
||||
|
Reference in New Issue
Block a user