Try to stop chrome form autofilling

This commit is contained in:
Henry Whitaker
2021-04-11 10:31:28 +01:00
parent a962865867
commit ce549b5b7a
5 changed files with 30 additions and 13 deletions

View File

@@ -279,11 +279,13 @@ export default class SettingsIndex extends Component {
},
{
obj: data.influx_db_username,
type: 'text'
type: 'text',
autoComplete: false,
},
{
obj: data.influx_db_password,
type: 'password'
type: 'password',
autoComplete: false,
}
],
};

View File

@@ -24,6 +24,7 @@ export default class SettingsInput extends Component {
inline: this.props.inline ? 'd-inline-block' : 'd-block',
btnType: this.props.btnType,
earlyReturn: this.props.earlyReturn ? true : false,
autoComplete: String(this.props.autoComplete ? true : Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 7)),
}
}
@@ -72,7 +73,8 @@ export default class SettingsInput extends Component {
disabled={disabled}
min={this.state.min}
max={this.state.max}
onInput={this.handleInput} />
onInput={this.handleInput}
autoComplete={this.state.autoComplete} />
}
generateSelectInput(disabled) {
@@ -109,7 +111,8 @@ export default class SettingsInput extends Component {
type={this.state.type}
defaultValue={this.state.value}
disabled={disabled}
onInput={this.handleInput} />
onInput={this.handleInput}
autoComplete={this.state.autoComplete} />
}
generatePasswordInput(disabled) {
@@ -118,7 +121,8 @@ export default class SettingsInput extends Component {
type={this.state.type}
defaultValue={this.state.value}
disabled={disabled}
onInput={this.handleInput} />
onInput={this.handleInput}
autoComplete={this.state.autoComplete} />
}
generateButtonGetInput() {

View File

@@ -107,6 +107,7 @@ export default class SettingsTabs extends Component {
url={setting.url}
earlyReturn={setting.earlyReturn ? true : false}
classes={setting.classes ? setting.classes : ''}
autoComplete={setting.autoComplete ? true : false}
/>
})
}

View File

@@ -32,7 +32,11 @@ export default class InfluxDBSettings extends Component {
return (
<Tab.Content>
{settings}
<form onSubmit={(e) => { e.preventDefault() }} autoComplete="off">
<input type="text" autoComplete="username" style={{ display: 'none' }} />
<input type="password" name="password" autoComplete="passoword" style={{ display: 'none' }} />
{settings}
</form>
<div className="mt-3">
<button className="btn btn-primary" onClick={() => { this.props.save(this.state.data, 'healthchecks.io') }}>Save</button>
</div>