import { Box, Button, color, config, Dialog, Header, Icon, IconButton, Icons, Text } from 'folds'; import React, { FormEventHandler } from 'react'; import { AuthType } from 'matrix-js-sdk'; import { StageComponentProps } from './types'; import { ErrorCode } from '../../cs-errorcode'; import { PasswordInput } from '../password-input'; export function PasswordStage({ stageData, submitAuthDict, onCancel, userId, }: StageComponentProps & { userId: string; }) { const { errorCode, error, session } = stageData; const handleFormSubmit: FormEventHandler = (evt) => { evt.preventDefault(); const { passwordInput } = evt.target as HTMLFormElement & { passwordInput: HTMLInputElement; }; const password = passwordInput.value; if (!password) return; submitAuthDict({ type: AuthType.Password, identifier: { type: 'm.id.user', user: userId, }, password, session, }); }; return (
Account Password
To perform this action you need to authenticate yourself by entering you account password. Password {errorCode && ( {errorCode === ErrorCode.M_FORBIDDEN ? 'Invalid Password!' : `${errorCode}: ${error}`} )}
); }