Merge pull request #2947 from matrix-org/travis/password-score-config
Add configuration flag to disable minimum password requirements
This commit is contained in:
commit
201fef8b11
2 changed files with 15 additions and 2 deletions
|
@ -76,6 +76,7 @@ module.exports = React.createClass({
|
||||||
password: "",
|
password: "",
|
||||||
passwordConfirm: "",
|
passwordConfirm: "",
|
||||||
passwordComplexity: null,
|
passwordComplexity: null,
|
||||||
|
passwordSafe: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -274,12 +275,23 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
const { scorePassword } = await import('../../../utils/PasswordScorer');
|
const { scorePassword } = await import('../../../utils/PasswordScorer');
|
||||||
const complexity = scorePassword(value);
|
const complexity = scorePassword(value);
|
||||||
|
const safe = complexity.score >= PASSWORD_MIN_SCORE;
|
||||||
|
const allowUnsafe = SdkConfig.get()["dangerously_allow_unsafe_and_insecure_passwords"];
|
||||||
this.setState({
|
this.setState({
|
||||||
passwordComplexity: complexity,
|
passwordComplexity: complexity,
|
||||||
|
passwordSafe: safe,
|
||||||
});
|
});
|
||||||
return complexity.score >= PASSWORD_MIN_SCORE;
|
return allowUnsafe || safe;
|
||||||
|
},
|
||||||
|
valid: function() {
|
||||||
|
// Unsafe passwords that are valid are only possible through a
|
||||||
|
// configuration flag. We'll print some helper text to signal
|
||||||
|
// to the user that their password is allowed, but unsafe.
|
||||||
|
if (!this.state.passwordSafe) {
|
||||||
|
return _t("Password is allowed, but unsafe");
|
||||||
|
}
|
||||||
|
return _t("Nice, strong password!");
|
||||||
},
|
},
|
||||||
valid: () => _t("Nice, strong password!"),
|
|
||||||
invalid: function() {
|
invalid: function() {
|
||||||
const complexity = this.state.passwordComplexity;
|
const complexity = this.state.passwordComplexity;
|
||||||
if (!complexity) {
|
if (!complexity) {
|
||||||
|
|
|
@ -1331,6 +1331,7 @@
|
||||||
"Enter email address (required on this homeserver)": "Enter email address (required on this homeserver)",
|
"Enter email address (required on this homeserver)": "Enter email address (required on this homeserver)",
|
||||||
"Doesn't look like a valid email address": "Doesn't look like a valid email address",
|
"Doesn't look like a valid email address": "Doesn't look like a valid email address",
|
||||||
"Enter password": "Enter password",
|
"Enter password": "Enter password",
|
||||||
|
"Password is allowed, but unsafe": "Password is allowed, but unsafe",
|
||||||
"Nice, strong password!": "Nice, strong password!",
|
"Nice, strong password!": "Nice, strong password!",
|
||||||
"Keep going...": "Keep going...",
|
"Keep going...": "Keep going...",
|
||||||
"Passwords don't match": "Passwords don't match",
|
"Passwords don't match": "Passwords don't match",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue