Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
[MM-26305] migrate string refs in password settings (#5753)
Browse files Browse the repository at this point in the history
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
  • Loading branch information
Willyfrog and mattermod authored Jun 24, 2020
1 parent 9d893c4 commit c71cd3d
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions components/admin_console/password_settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,19 @@ export default class PasswordSettings extends AdminSettings {
}}
/>
);

this.lowercase = React.createRef();
this.uppercase = React.createRef();
this.number = React.createRef();
this.symbol = React.createRef();
}

getConfigFromState = (config) => {
config.PasswordSettings.MinimumLength = this.parseIntNonZero(this.state.passwordMinimumLength, Constants.MIN_PASSWORD_LENGTH);
config.PasswordSettings.Lowercase = this.refs.lowercase.checked;
config.PasswordSettings.Uppercase = this.refs.uppercase.checked;
config.PasswordSettings.Number = this.refs.number.checked;
config.PasswordSettings.Symbol = this.refs.symbol.checked;
config.PasswordSettings.Lowercase = this.lowercase.current.checked;
config.PasswordSettings.Uppercase = this.uppercase.current.checked;
config.PasswordSettings.Number = this.number.current.checked;
config.PasswordSettings.Symbol = this.symbol.current.checked;

config.ServiceSettings.MaximumLoginAttempts = this.parseIntNonZero(this.state.maximumLoginAttempts);

Expand Down Expand Up @@ -102,16 +107,16 @@ export default class PasswordSettings extends AdminSettings {
);
}
let sampleErrorMsgId = 'user.settings.security.passwordError';
if (this.refs.lowercase.checked) {
if (this.lowercase.current.checked) {
sampleErrorMsgId += 'Lowercase';
}
if (this.refs.uppercase.checked) {
if (this.uppercase.current.checked) {
sampleErrorMsgId += 'Uppercase';
}
if (this.refs.number.checked) {
if (this.number.current.checked) {
sampleErrorMsgId += 'Number';
}
if (this.refs.symbol.checked) {
if (this.symbol.current.checked) {
sampleErrorMsgId += 'Symbol';
}
return (
Expand Down Expand Up @@ -184,7 +189,7 @@ export default class PasswordSettings extends AdminSettings {
<label className='checkbox-inline'>
<input
type='checkbox'
ref='lowercase'
ref={this.lowercase}
defaultChecked={this.state.passwordLowercase}
name='admin.password.lowercase'
onChange={this.handleCheckboxChange}
Expand All @@ -199,7 +204,7 @@ export default class PasswordSettings extends AdminSettings {
<label className='checkbox-inline'>
<input
type='checkbox'
ref='uppercase'
ref={this.uppercase}
defaultChecked={this.state.passwordUppercase}
name='admin.password.uppercase'
onChange={this.handleCheckboxChange}
Expand All @@ -214,7 +219,7 @@ export default class PasswordSettings extends AdminSettings {
<label className='checkbox-inline'>
<input
type='checkbox'
ref='number'
ref={this.number}
defaultChecked={this.state.passwordNumber}
name='admin.password.number'
onChange={this.handleCheckboxChange}
Expand All @@ -229,7 +234,7 @@ export default class PasswordSettings extends AdminSettings {
<label className='checkbox-inline'>
<input
type='checkbox'
ref='symbol'
ref={this.symbol}
defaultChecked={this.state.passwordSymbol}
name='admin.password.symbol'
onChange={this.handleCheckboxChange}
Expand Down

0 comments on commit c71cd3d

Please sign in to comment.