Skip to content

Commit

Permalink
Fixed #7357
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jan 11, 2021
1 parent e6b5ac7 commit 4f85b4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Fixed a bug where the “All” checkbox label was getting HTML-encoded when using `Craft.ui.createCheckboxSelect()`.
- Fixed a bug where week day and month names were being translated based on the current formatting locale, rather than the current language. ([#7312](https://github.com/craftcms/cms/issues/7312))
- Fixed a bug where `craft\elements\Asset::getSrcset()` could return the wrong value if the asset had a named transform set on it. ([#7352](https://github.com/craftcms/cms/issues/7352))
- Fixed a bug where user registration forms could get a “Username cannot be blank” error even if the `useEmailAsUsername` config setting was enabled. ([#7357](https://github.com/craftcms/cms/issues/7357))

## 3.5.17.1 - 2020-12-17

Expand Down
8 changes: 6 additions & 2 deletions src/elements/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,14 @@ protected function defineRules(): array
$rules[] = [['email', 'unverifiedEmail'], 'email', 'enableIDN' => $enableIdn];
$rules[] = [['email', 'password', 'unverifiedEmail'], 'string', 'max' => 255];
$rules[] = [['username', 'firstName', 'lastName', 'verificationCode'], 'string', 'max' => 100];
$rules[] = [['username', 'email'], 'required'];
$rules[] = [['username'], UsernameValidator::class];
$rules[] = [['email'], 'required'];
$rules[] = [['lastLoginAttemptIp'], 'string', 'max' => 45];

if (!Craft::$app->getConfig()->getGeneral()->useEmailAsUsername) {
$rules[] = [['username'], 'required'];
$rules[] = [['username'], UsernameValidator::class];
}

if (Craft::$app->getIsInstalled()) {
$rules[] = [
['username', 'email'],
Expand Down

0 comments on commit 4f85b4e

Please sign in to comment.