();\r\n this.focusUsernameInput = this.focusUsernameInput.bind(this);\r\n this.focusPasswordInput = this.focusPasswordInput.bind(this);\r\n }\r\n\r\n public render() {\r\n const { data, errors, formIsValid, userConfirmed, awaitingConfirmation, awaitingLogin, loginWarning } = this.state;\r\n let actionButton;\r\n if (!userConfirmed && !awaitingConfirmation) {\r\n actionButton = (\r\n \r\n );\r\n } else if (awaitingConfirmation) {\r\n actionButton = (\r\n \r\n \r\n
\r\n );\r\n } else {\r\n actionButton = null;\r\n }\r\n return (\r\n \r\n );\r\n }\r\n\r\n protected handleSubmit = async (e: React.MouseEvent | React.FormEvent) => {\r\n e.preventDefault();\r\n\r\n this.setState({ awaitingLogin: true });\r\n\r\n const errors = await this.validate();\r\n this.setState({ errors: errors || {} });\r\n if (errors) {\r\n this.setState({ awaitingLogin: false });\r\n return;\r\n }\r\n\r\n await postJsonDataNoSession(window.location.href, this.state.data)\r\n .then((response) => {\r\n const loginWarning = response.headers.get('Warning');\r\n const redirectUrl = response.headers.get('NavigateTo');\r\n if (loginWarning) {\r\n const data = { ...this.state.data };\r\n data.password = '';\r\n this.focusPasswordInput();\r\n this.setState({ data, loginWarning, awaitingLogin: false });\r\n return;\r\n } else if (redirectUrl) {\r\n window.location.replace(redirectUrl);\r\n } else {\r\n const unknownError = 'An unknown error occurred. Please try again.';\r\n this.setState({ loginWarning: unknownError, awaitingLogin: false });\r\n }\r\n });\r\n }\r\n\r\n protected handleUsernameClick = () => {\r\n this.setState({ userConfirmed: false, loginWarning: null }, () => {\r\n this.focusUsernameInput();\r\n });\r\n }\r\n\r\n private checkUser = async (e: React.MouseEvent | React.FormEvent) => {\r\n e.preventDefault();\r\n\r\n const errors = { ...this.state.errors };\r\n const errorMessage = await this.validateProperty({ name: 'username', value: this.state.data.username });\r\n if (errorMessage) {\r\n errors.username = errorMessage.username;\r\n this.setState({ errors });\r\n return;\r\n } else {\r\n delete errors.username;\r\n }\r\n\r\n // hold for\r\n this.setState({ awaitingConfirmation: true }, () => {\r\n const { username } = this.state.data;\r\n postData('/Account/IsLocalAccount', { username })\r\n .then((response) => {\r\n if (response.localAccount) {\r\n this.setState({\r\n userConfirmed: true,\r\n awaitingConfirmation: false,\r\n }, () => {\r\n this.focusPasswordInput();\r\n });\r\n } else {\r\n const returnTo = escape(getParameterByName('returnUrl') || '/');\r\n window.location.replace(`/Account/RemoteAuthenticate?username=${username}&returnURL=${returnTo}`);\r\n }\r\n })\r\n .catch(() => {\r\n errors.username = 'An error occurred.';\r\n this.setState({\r\n errors,\r\n userConfirmed: false,\r\n awaitingConfirmation: false,\r\n }, () => {\r\n this.focusUsernameInput();\r\n });\r\n });\r\n });\r\n }\r\n\r\n private focusUsernameInput() {\r\n this.usernameInput.current.focus();\r\n }\r\n\r\n private focusPasswordInput() {\r\n this.passwordInput.current.focus();\r\n }\r\n}\r\n","import '../../../scss/react/login/login.scss';\r\n\r\nimport * as React from 'react';\r\n\r\nimport { BrowserSupportBanner } from '../shared-components/browser-support-banner';\r\nimport { LoginForm } from './login-form';\r\n\r\nimport '../../../images/map-logo.svg';\r\nimport '../../../scss/map.scss';\r\n\r\nexport class Login extends React.Component {\r\n public render() {\r\n return (\r\n <>\r\n \r\n \r\n \r\n >\r\n );\r\n }\r\n}\r\n"],"sourceRoot":""}