Ensure invite form always returns a base error (#8615)

This commit is contained in:
Luke Heath
2022-11-08 15:34:18 -06:00
committed by GitHub
parent 52dea440cf
commit 5493417fee
2 changed files with 4 additions and 2 deletions
@@ -12,6 +12,7 @@ const formFields = ["new_password", "new_password_confirmation"];
class ResetPasswordForm extends Component {
static propTypes = {
baseError: PropTypes.string,
handleSubmit: PropTypes.func,
fields: PropTypes.shape({
new_password: formFieldInterface.isRequired,
@@ -20,10 +21,11 @@ class ResetPasswordForm extends Component {
};
render() {
const { fields, handleSubmit } = this.props;
const { baseError, fields, handleSubmit } = this.props;
return (
<form onSubmit={handleSubmit} className={baseClass}>
{baseError && <div className="form__base-error">{baseError}</div>}
<InputFieldWithIcon
{...fields.new_password}
autofocus
@@ -14,7 +14,7 @@ const formatServerErrors = (errors: IError[]) => {
if (result[name]) {
result[name] = join([result[name], reason], ", ");
} else {
result[name] = reason;
result.base = reason; // Ensure a base error is always returned
}
});