Skip to content

Commit

Permalink
Merge pull request #30228 from bernhardoj/fix/29192-login-not-saved-o…
Browse files Browse the repository at this point in the history
…n-refresh

Fix going back from magic code page after refresh doesn't show the submitted email
  • Loading branch information
marcochavezf authored Oct 24, 2023
2 parents 373647c + 8eca62a commit 44e52fd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/pages/signin/LoginForm/BaseLoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand All @@ -78,6 +84,9 @@ const propTypes = {

const defaultProps = {
account: {},
credentials: {
login: '',
},
closeAccount: {},
blurOnSubmit: false,
innerRef: () => {},
Expand All @@ -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);

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 44e52fd

Please sign in to comment.