mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
parent
f5935a37be
commit
57de74b2c1
@ -61,6 +61,7 @@ HumHub Changelog
|
||||
- Enh #7188: Helper for detecting a current path by module/controller/action
|
||||
- Enh #7265: Profile "About" page: don't display the menu if only one entry
|
||||
- Enh #7269: Remove desktop notifications
|
||||
- Enh #5423: Display password rules in form field hint
|
||||
|
||||
1.16.3 (Unreleased)
|
||||
--------------------------
|
||||
|
@ -13,6 +13,7 @@ Version 1.17 (Unreleased)
|
||||
### New
|
||||
- CSS variables: `--hh-fixed-header-height` and `--hh-fixed-footer-height` (see [#7131](https://github.com/humhub/humhub/issues/7131)): these variables should be added to custom themes in the `variables.less` file to overwrite the fixed header (e.g. the top menu + margins) and footer heights with the ones of the custom theme.
|
||||
- `\humhub\modules\user\Module::enableRegistrationFormCaptcha` which is true by default (can be disabled via [file configuration](https://docs.humhub.org/docs/admin/advanced-configuration#module-configurations))
|
||||
- User `Module::$passwordHint` (see [#5423](https://github.com/humhub/humhub/issues/5423))
|
||||
|
||||
### Deprecated
|
||||
- Method `humhub\modules\ui\menu\MenuEntry::isActiveState()` is replaced with `humhub\helpers\ControllerHelper::isActivePath()`
|
||||
|
@ -127,6 +127,16 @@ class Module extends \humhub\components\Module
|
||||
*/
|
||||
public $passwordStrength = [];
|
||||
|
||||
/**
|
||||
* Password hint to display in the registration and password changing forms
|
||||
* E.g.: 'Minimum 8 characters, at least one uppercase letter, one lowercase letter and one number'
|
||||
* Can be translated via the `UserModule.base` file (see https://docs.humhub.org/docs/admin/translations#overwrite-translation-messages)
|
||||
* If empty, no hint will be displayed, except if the passwordStrength has only one rule.
|
||||
* @var null|string
|
||||
* @since 1.17
|
||||
*/
|
||||
public $passwordHint = null;
|
||||
|
||||
/**
|
||||
* @var bool disable profile stream
|
||||
* @since 1.6
|
||||
@ -278,6 +288,20 @@ class Module extends \humhub\components\Module
|
||||
return $this->getDefaultPasswordStrength() !== $this->getPasswordStrength();
|
||||
}
|
||||
|
||||
public function getPasswordHint(): ?string
|
||||
{
|
||||
if ($this->passwordHint) {
|
||||
return Yii::t('UserModule.base', $this->passwordHint);
|
||||
}
|
||||
// If only one rule, display it as hint
|
||||
$passwordStrength = $this->getPasswordStrength();
|
||||
if ($passwordStrength && count($passwordStrength) === 1) {
|
||||
$firstRule = reset($passwordStrength);
|
||||
return $firstRule ?: null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default group
|
||||
* @return Group
|
||||
|
@ -10,6 +10,7 @@ namespace humhub\modules\user\models;
|
||||
|
||||
use humhub\libs\UUID;
|
||||
use humhub\modules\user\components\CheckPasswordValidator;
|
||||
use humhub\modules\user\Module;
|
||||
use Yii;
|
||||
use yii\base\ErrorException;
|
||||
use yii\base\Exception;
|
||||
@ -153,6 +154,18 @@ class Password extends ActiveRecord
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inerhitdoc
|
||||
*/
|
||||
public function attributeHints()
|
||||
{
|
||||
/* @var $module Module */
|
||||
$module = Yii::$app->getModule('user');
|
||||
$passwordHint = $module->getPasswordHint();
|
||||
|
||||
return $passwordHint ? ['newPassword' => $passwordHint] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a given password against database record
|
||||
*
|
||||
|
@ -5,6 +5,7 @@ namespace humhub\modules\user\models\forms;
|
||||
use humhub\modules\user\assets\UserAsset;
|
||||
use humhub\modules\user\authclient\BaseClient;
|
||||
use humhub\modules\user\authclient\BaseFormAuth;
|
||||
use humhub\modules\user\Module;
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
|
||||
@ -66,6 +67,18 @@ class Login extends Model
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inerhitdoc
|
||||
*/
|
||||
public function attributeHints()
|
||||
{
|
||||
/* @var $module Module */
|
||||
$module = Yii::$app->getModule('user');
|
||||
$passwordHint = $module->getPasswordHint();
|
||||
|
||||
return $passwordHint ? ['password' => $passwordHint] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user