Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Deactivate by default user setting not working #11519

Closed
yzaman24 opened this issue Jun 28, 2022 · 5 comments
Closed

[4.x]: Deactivate by default user setting not working #11519

yzaman24 opened this issue Jun 28, 2022 · 5 comments

Comments

@yzaman24
Copy link

What happened?

Description

The deactivate by default setting for public user registrations does not work and is not used.

Specifically this part of the Users Controller's action "SaveUser" :
// If this is a new user and email verification isn't required, // go ahead and activate them now. if ($isNewUser && !$requireEmailVerification) { Craft::$app->getUsers()->activateUser($user); }

There is a var ($deactivateByDefault) that is not used in the logic above.

Steps to reproduce

  1. Select the checkbox labelled "Deactivate users by default" under user settings.
  2. Create a registration form on the front-end that will create a user outside of the control panel.
  3. User gets added already activated.

Expected behavior

With the option above enabled, users should not be activated upon registration.

Actual behavior

Users are activated after creation.

Craft CMS version

4.0.5

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@brandonkelly
Copy link
Member

That setting only comes into effect during public registration. If you were logged-in with your existing account when you submitted the registration form, then that’s just normal user registration (identical to creating a user from the control panel).

@yzaman24
Copy link
Author

I understand that, but I don't think it works. I am carrying out a public registration. Each time, the account is activated by default and I am able to log in as that user.

@Mosnar
Copy link
Contributor

Mosnar commented Jun 29, 2022

I was able to reproduce this issue when the "Verify email addresses" setting is unchecked.

@brandonkelly
Copy link
Member

Thanks! Just got this fixed for the next release.

@brandonkelly
Copy link
Member

Craft 4.1.1 is out now with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants