Skip to content

Commit

Permalink
fix: prevent browser autofill on password fields
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric authored Nov 14, 2019
2 parents 2394732 + 5832113 commit 71736ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/account/AccountEditor.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class AccountEditor extends Component {
floatingLabelText: this.context.d2.i18n.getTranslation('old_password'),
style: { width: '100%' },
changeEvent: 'onBlur',
autoComplete: 'new-password',
},
validators: [{
validator: this.isNotEmpty,
Expand All @@ -101,6 +102,7 @@ class AccountEditor extends Component {
floatingLabelText: this.context.d2.i18n.getTranslation('new_password'),
style: { width: '100%' },
changeEvent: 'onBlur',
autoComplete: 'new-password',
},
validators: [{
validator: isValidPassword,
Expand All @@ -116,6 +118,7 @@ class AccountEditor extends Component {
floatingLabelText: this.context.d2.i18n.getTranslation('repeat_new_password'),
style: { width: '100%' },
changeEvent: 'onBlur',
autoComplete: 'new-password',
},
validators: [{
validator: this.isSamePassword,
Expand Down
4 changes: 3 additions & 1 deletion src/layout/FormFields.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ class FormFields extends Component {
return (
<div className="content-area">
<div style={styles.header}>{this.props.pageLabel}</div>
{this.renderFields(this.props.fieldKeys)}
<form autoComplete="off">
{this.renderFields(this.props.fieldKeys)}
</form>
</div>
);
}
Expand Down

0 comments on commit 71736ac

Please sign in to comment.