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

WIP: Try adding guest user library #3

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

partizipation
Copy link
Contributor

@partizipation partizipation commented Feb 12, 2025

we decided to fork django-guest-user and add email and password for the guest authentication. See here

Couldn't get around the circular reference, tried a bunch of things. Code has a bunch of commented out attempts so it's a little messy but maybe this PR helps review.

Tried:

  • all possible order of guest stuff, auth, and apps.users in INSTALLED_APPS
  • importing in different ways from within users/models.py
  • registering in users/apps.py in a couple different ways

@partizipation partizipation requested a review from m4ra February 12, 2025 16:10
@m4ra m4ra force-pushed the jp-2502-guest-accounts branch from c3e2c5d to dc4a661 Compare February 13, 2025 14:02
@m4ra
Copy link
Contributor

m4ra commented Feb 13, 2025

@partizipation @goapunk to enable the guest user from the registration form, I would add the maybe_make_guest_user in the a+ DefaultSingUpForm.save().
In that way we don't need a middleware. and the guest user will behave as a regular one. In the Account Settings we will need a check in the request.user if they have a user.geust relation then we should add the conversion form component instead of regular profile. Or something down this line.

@m4ra m4ra requested a review from goapunk February 13, 2025 14:11
@m4ra
Copy link
Contributor

m4ra commented Feb 13, 2025

@partizipation the signup template to add the login as guest button is here. But I think the registration form is in a separate story.


GUEST_USER = {
"NAME_GENERATOR": "guest_user.functions.generate_uuid_username", # Default option
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this in the fork of the django-guest, because the long uuid appears on the menu tab and it's ugly. So I switched to the numbered version. But maybe we deploy this one, and PM can let us know.

{% url 'guest_create' as guest_create_url %}
{% with next_param=request.GET.next %}
{% with guest_url=guest_create_url|add:"?next="|add:next_param %}
<p>{% blocktranslate %}Sie wollen als Gast fortfahren? Dann klicken Sie <a href="{{ guest_url }}">hier</a>.{% endblocktranslate %}</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the english version here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asked Janek for english text yesterday, so waiting to add the content of these pages until I have that and can just do everything at once

{% with next_param=request.GET.next %}
{% with guest_url=guest_create_url|add:"?next="|add:next_param %}
<p>
{% blocktranslate %}Sie wollen als Gast fortfahren? Dann klicken Sie
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

<button class="btn btn--primary btn--secondary-filled" type="submit">{% translate "Continue as Guest" %}</button>
</div>
</form>
{% endblock content %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add the guest part in the signup template?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean go ahead and add the rest of what's in designs, or are you talking about structuring this differently and making accounts/signup.html multipurpose? or something else

@partizipation partizipation force-pushed the jp-2502-guest-accounts branch from 391ad52 to 2ed7317 Compare March 3, 2025 17:42
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

Successfully merging this pull request may close these issues.

2 participants