-
Notifications
You must be signed in to change notification settings - Fork 1
Custom Login
maximilianweidenauer edited this page Oct 3, 2023
·
1 revision
You are able to replace the default login-views, with your custom-login views for each login-mode. It is possible to just replace specific mode's so not every view has to be implemented.
- Create your custom login-view components and write your own login-view.
Parameter | Type | Description |
---|---|---|
username | string | The currently entered username. |
password | string | The currently entered password. |
setLoginMode | (loginMode: "default", "reset", "mFTextInput", "mFWait", "mFURL") => void | Sets the current login mode (displayed view). |
sendLoginRequest | (username: string, password: string, rememberMe?:boolean, options?:any) => void | A function which sends a login-request to the server, pass the username and the password, if you want add a remember me field for autologin. In the options field you can pass any additional parameters which the server should process. |
Source to an example custom-login-view can be found here.
Parameter | Type | Description |
---|---|---|
username | string | The currently entered username. |
password | string | The currently entered password. |
setLoginMode | (loginMode: "default", "reset", "mFTextInput", "mFWait", "mFURL") => void | Sets the current login mode (displayed view). |
sendResetRequest | (identifier: string, options?:any) => void | A function which sends a reset-password-request to the server, pass the identifier (e.g. email) and in the options field you can pass any additional parameters which the server should process. |
Source to an example custom-reset-view can be found here.
Parameter | Type | Description |
---|---|---|
username | string | The currently entered username. |
password | string | The currently entered password. |
setLoginMode | (loginMode: "default", "reset", "mFTextInput", "mFWait", "mFURL") => void | Sets the current login mode (displayed view). |
sendLoginRequest | (username: string, password: string, code: string, options?:any) => void | A function which sends a login-request to the server, pass the username and the password and the code for your multi factor authentication. In the options field you can pass any additional parameters which the server should process. |
Parameter | Type | Description |
---|---|---|
username | string | The currently entered username. |
password | string | The currently entered password. |
setLoginMode | (loginMode: "default", "reset", "mFTextInput", "mFWait", "mFURL") => void | Sets the current login mode (displayed view). |
mfaData | { code: string, timeout: number, timeoutReset: boolean, undefined }, { link: string/ {target?: "_self", "_blank", url: string, height?: number, width?: number}, timeout: number, timeoutReset: boolean, undefined } | Contains the information for the multi factor authentification. |
- In your main class (e.g. App.tsx) call the
api.addCustomLogin
function in a function, which will then be passed in theonStartup
property used in theReactUI
component.
Parameter | Type | Description |
---|---|---|
defaultView | (props: ICustomDefaultLogin) => ReactElement, undefined | A function to render your custom login. |
resetView | (props: ICustomResetLogin) => ReactElement, undefined | A function to render your custom reset. |
mfaTextView | (props: ICustomMFAText) => ReactElement, undefined | A function to render your custom multi factor authentication (text). |
mfaWaitView | (props: ICustomMFAWait) => ReactElement, undefined | A function to render your custom multi factor authentication (wait). |
mfaUrlView | (props: ICustomMFAUrl) => ReactElement, undefined | A function to render your custom multi factor authentication (url). |
const api = useAPI();
const onStartup = () => {
api.addCustomLogin((props) => <CustomLoginView {...props} />, true, true);
}
return (
<ReactUI onStartup={onStartup} />
);
Loginmode "default":
Loginmode "reset":
Loginmode "default: Loginmode "default":
Loginmode "reset":