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

User plugin registering guests users #544

Open
thedoofus opened this issue Jun 5, 2024 · 2 comments
Open

User plugin registering guests users #544

thedoofus opened this issue Jun 5, 2024 · 2 comments

Comments

@thedoofus
Copy link

In the docs (linked below) under guest users, it says you can create a guest by passing the 'is_guest' => true" - is this the create method because none is shown in the example given. You also get a validation error because a first_name is required. Is it possible to bypass this?

https://github.com/rainlab/user-plugin/blob/master/docs/auth-manager.md

It also states that you can convert a guest user to a registered user by providing password and confirmation along with the email address to the create method, and you won't receive a "email already taken" error - but this doesn't seem to be the case.

I can get round this by getting the user, running the convertToRegistered() method setting the password, and name manually.

On that, the convertToRegistered() method keeps the guest group as the primary group - shouldn't this get updated to the Registered group at this point?

@daftspunk
Copy link
Member

This does look like a bit of a schemozzle...

Everything you've mentioned here is correct. The first_name attribute is required in this version, so populate it with "Guest" or something or remove it from the validation rules (not recommended).

This has been fixed, docs and tests have been updated in 9a0d5eb

Thanks! Let me know if you spot any other inconsistencies.

@thedoofus
Copy link
Author

thedoofus commented Sep 26, 2024

Hi @daftspunk

Sorry to bring this one up again. The frontend Register component still includes the unique validation on the email address. So trying to register an account, with an email that's previously been used for a guest fails when using this component.

'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],

And should unique be removed from the login column at database level too?

@daftspunk daftspunk reopened this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants