code optimization
This commit is contained in:
parent
36f82aa68c
commit
7ddb7ff429
|
@ -72,7 +72,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
}.property('authOptions.auth_provider'),
|
}.property('authOptions.auth_provider'),
|
||||||
|
|
||||||
passwordInstructions: function() {
|
passwordInstructions: function() {
|
||||||
return this.get('isDeveloper') ? I18n.t('user.password.instructions', {count: Discourse.SiteSettings.min_admin_password_length}) : I18n.t('user.password.instructions', {count: Discourse.SiteSettings.min_password_length});
|
return this.get('isDeveloper') ? I18n.t('user.password.instructions', {count: this.siteSettings.min_admin_password_length}) : I18n.t('user.password.instructions', {count: this.siteSettings.min_password_length});
|
||||||
}.property('isDeveloper'),
|
}.property('isDeveloper'),
|
||||||
|
|
||||||
nameInstructions: function() {
|
nameInstructions: function() {
|
||||||
|
@ -284,16 +284,9 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
return Discourse.InputValidation.create({ failed: true });
|
return Discourse.InputValidation.create({ failed: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// If too short for Admin
|
// If too short
|
||||||
if (this.get('isDeveloper') && password.length < Discourse.SiteSettings.min_admin_password_length) {
|
const passwordLength = this.get('isDeveloper') ? this.siteSettings.min_admin_password_length : this.siteSettings.min_password_length;
|
||||||
return Discourse.InputValidation.create({
|
if (password.length < passwordLength) {
|
||||||
failed: true,
|
|
||||||
reason: I18n.t('user.password.too_short')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// If too short for normal user
|
|
||||||
if (!this.get('isDeveloper') && password.length < Discourse.SiteSettings.min_password_length) {
|
|
||||||
return Discourse.InputValidation.create({
|
return Discourse.InputValidation.create({
|
||||||
failed: true,
|
failed: true,
|
||||||
reason: I18n.t('user.password.too_short')
|
reason: I18n.t('user.password.too_short')
|
||||||
|
|
Loading…
Reference in New Issue