matrix-react-sdk
Version:
SDK for matrix.org using React
64 lines (63 loc) • 2.33 kB
TypeScript
import React, { ReactNode } from "react";
import { ClientLoginFlow } from "../../../Login";
import { IMatrixClientCreds } from "../../../MatrixClientPeg";
import { ButtonEvent } from "../../views/elements/AccessibleButton";
import { ValidatedServerConfig } from "../../../utils/ValidatedServerConfig";
interface IProps {
serverConfig: ValidatedServerConfig;
busy?: boolean;
isSyncing?: boolean;
fallbackHsUrl?: string;
defaultDeviceDisplayName?: string;
fragmentAfterLogin?: string;
defaultUsername?: string;
onLoggedIn(data: IMatrixClientCreds, password: string): void;
onRegisterClick(): void;
onForgotPasswordClick?(): void;
onServerConfigChange(config: ValidatedServerConfig): void;
}
interface IState {
busy: boolean;
busyLoggingIn?: boolean;
errorText?: ReactNode;
loginIncorrect: boolean;
canTryLogin: boolean;
flows?: ClientLoginFlow[];
username: string;
phoneCountry: string;
phoneNumber: string;
serverIsAlive: boolean;
serverErrorIsFatal: boolean;
serverDeadError?: ReactNode;
}
type OnPasswordLogin = {
(username: string, phoneCountry: undefined, phoneNumber: undefined, password: string): Promise<void>;
(username: undefined, phoneCountry: string, phoneNumber: string, password: string): Promise<void>;
};
export default class LoginComponent extends React.PureComponent<IProps, IState> {
private unmounted;
private oidcNativeFlowEnabled;
private loginLogic;
private readonly stepRendererMap;
constructor(props: IProps);
componentDidMount(): void;
componentWillUnmount(): void;
componentDidUpdate(prevProps: IProps): void;
isBusy: () => boolean;
onPasswordLogin: OnPasswordLogin;
onUsernameChanged: (username: string) => void;
onUsernameBlur: (username: string) => Promise<void>;
onPhoneCountryChanged: (phoneCountry: string) => void;
onPhoneNumberChanged: (phoneNumber: string) => void;
onRegisterClick: (ev: ButtonEvent) => void;
onTryRegisterClick: (ev: ButtonEvent) => void;
private checkServerLiveliness;
private initLoginLogic;
private isSupportedFlow;
renderLoginComponentForFlows(): ReactNode;
private renderPasswordStep;
private renderOidcNativeStep;
private renderSsoStep;
render(): React.ReactNode;
}
export {};