import React from "react"; import { Callout, Link, PrimaryButton, Stack, Text, TextField } from "@fluentui/react"; import ISandboxProps from "../../Interfaces/ISandboxProps"; import { Strings } from "../../Services/LocalizationService"; interface IStates { login : string; password : string; loginError?: string; passwordError?: string; showHint : boolean; } export default class SandboxOne extends React.Component { constructor(props : ISandboxProps) { super(props); this.state = { login: "", password: "", loginError: null, passwordError: null, showHint: false }; } private OnSubmit() : void { let newState : IStates = this.state; newState.loginError = null; newState.passwordError = null; if (newState.login.toLocaleLowerCase() !== "test-user@example.com") newState.loginError = Strings.sandboxLoginError; if (newState.password !== ".tSYRc:eYP_868p") newState.passwordError = Strings.sandboxPasswordError; if (newState.login === "") newState.loginError = Strings.sandboxEmptyField; if (newState.password === "") newState.passwordError = Strings.sandboxEmptyField; this.setState(newState); if (newState.loginError === null && newState.passwordError === null) this.props.context.current.OnFinished(); } private OnPaste(event : React.ClipboardEvent) : boolean { event.preventDefault(); return false; } public render() : JSX.Element { return ( { Strings.sandboxLoginHeader } this.setState({ ...this.state, login: e }) } errorMessage={ this.state.loginError } /> this.setState({ ...this.state, password: e }) } errorMessage={ this.state.passwordError } /> this.setState({ ...this.state, showHint: true })}>{ Strings.sandbox1forgotPassword } this.OnSubmit() } /> { this.state.showHint && this.setState({ ...this.state, showHint: false }) } target="#credentialHintLink" > { Strings.startPrereqLogin }: test-user@example.com { Strings.startPrereqPassword }: .tSYRc:eYP_868p } ); } }