</dl>
{event name='changePasswordFields'}
+
+ <script data-relocate="true">
+ require(['WoltLabSuite/Core/Ui/User/PasswordStrength'], function (PasswordStrength) {
+ var relatedInputs = [];
+ if (elById('username')) relatedInputs.push(elById('username'));
+ if (elById('email')) relatedInputs.push(elById('email'));
+
+ new PasswordStrength(elById('newPassword'), {
+ relatedInputs: relatedInputs,
+ staticDictionary: [
+ '{$__wcf->user->username|encodeJS}',
+ '{$__wcf->user->email|encodeJS}',
+ ]
+ });
+ })
+ </script>
</section>
{/if}
use wcf\system\email\mime\RecipientAwareTextMimePart;
use wcf\system\email\Email;
use wcf\system\email\UserMailbox;
+use wcf\system\exception\SystemException;
use wcf\system\exception\UserInputException;
use wcf\system\menu\user\UserMenu;
use wcf\system\WCF;
use wcf\util\HeaderUtil;
+use wcf\util\JSON;
use wcf\util\PasswordUtil;
use wcf\util\StringUtil;
use wcf\util\UserRegistrationUtil;
*/
public $newPassword = '';
+ /**
+ * @var mixed[]
+ */
+ public $newPasswordStrengthVerdict = [];
+
/**
* confirmed new password
* @var string
if (isset($_POST['email'])) $this->email = $_POST['email'];
if (isset($_POST['confirmEmail'])) $this->confirmEmail = $_POST['confirmEmail'];
if (isset($_POST['newPassword'])) $this->newPassword = $_POST['newPassword'];
+ if (isset($_POST['newPassword_passwordStrengthVerdict'])) {
+ try {
+ $this->newPasswordStrengthVerdict = JSON::decode($_POST['newPassword_passwordStrengthVerdict']);
+ }
+ catch (SystemException $e) {
+ // ignore
+ }
+ }
if (isset($_POST['confirmNewPassword'])) $this->confirmNewPassword = $_POST['confirmNewPassword'];
if (isset($_POST['username'])) $this->username = StringUtil::trim($_POST['username']);
if (isset($_POST['quit'])) $this->quit = intval($_POST['quit']);
throw new UserInputException('confirmNewPassword');
}
- if (!UserRegistrationUtil::isSecurePassword($this->newPassword)) {
+ if (($this->newPasswordStrengthVerdict['score'] ?? 4) < PASSWORD_MIN_SCORE) {
throw new UserInputException('newPassword', 'notSecure');
}