diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index ab548619b631..9c597b73fc5c 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -60,6 +60,12 @@ const propTypes = { success: PropTypes.string, }), + /** The credentials of the logged in person */ + credentials: PropTypes.shape({ + /** The email the user logged in with */ + login: PropTypes.string, + }), + /** Props to detect online status */ network: networkPropTypes.isRequired, @@ -78,6 +84,9 @@ const propTypes = { const defaultProps = { account: {}, + credentials: { + login: '', + }, closeAccount: {}, blurOnSubmit: false, innerRef: () => {}, @@ -86,7 +95,7 @@ const defaultProps = { function LoginForm(props) { const input = useRef(); - const [login, setLogin] = useState(''); + const [login, setLogin] = useState(() => Str.removeSMSDomain(props.credentials.login)); const [formError, setFormError] = useState(false); const prevIsVisible = usePrevious(props.isVisible); @@ -299,6 +308,7 @@ export default compose( withNavigationFocus, withOnyx({ account: {key: ONYXKEYS.ACCOUNT}, + credentials: {key: ONYXKEYS.CREDENTIALS}, closeAccount: {key: ONYXKEYS.FORMS.CLOSE_ACCOUNT_FORM}, }), withWindowDimensions,