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

Second call to User.Identity.IsAuthenticated or even User in template started to return nothing #17393

Open
SzymonSel opened this issue Jan 23, 2025 · 16 comments

Comments

@SzymonSel
Copy link
Member

Describe the bug

After updating from 2.1.0-preview-18407 to 3.0.0-preview-18420, a liquid template containing twice User.Identity.IsAuthenticated stopped working correctly.

I checked the values by the calls. The first is true or false, but the second is empty.
Assigning User.Identity.IsAuthenticated to a variable worked

@SzymonSel SzymonSel changed the title Second call to User.Identity.IsAuthenticated in templated started to return nothing Second call to User.Identity.IsAuthenticated or even User in templatestarted to return nothing Jan 23, 2025
@SzymonSel SzymonSel changed the title Second call to User.Identity.IsAuthenticated or even User in templatestarted to return nothing Second call to User.Identity.IsAuthenticated or even User in template started to return nothing Jan 23, 2025
@SzymonSel
Copy link
Member Author

So only the first call to User works.

@SzymonSel
Copy link
Member Author

I can confirm this still happens in 3.0.0-preview-18484

@sebastienros sebastienros added this to the 3.0 milestone Jan 23, 2025
Copy link
Contributor

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

@sebastienros
Copy link
Member

If nobody tried to repro maybe your could try an older version of Fluid just to rule it out.

@sebastienros
Copy link
Member

sebastienros commented Jan 23, 2025

Isolated changes from the build numbers you provided (18407 to 18420) to these:

f331657...692c4ba

@gvkries
Copy link
Contributor

gvkries commented Jan 24, 2025

So, if I understand it correctly, this fails?

{% if User.Identity.IsAuthenticated %}
<h1>IsAuthenticated 1</h1>
{% endif %}

{% if User.Identity.IsAuthenticated %}
<h1>IsAuthenticated 2</h1>
{% endif %}

It works for me...

@SzymonSel
Copy link
Member Author

Correct, I'll try narrowing it down and isolating.
Strangly this occurred in three apps, which don't share any code base apart from OrchardCore

@gvkries
Copy link
Contributor

gvkries commented Jan 24, 2025

I tried this on a fresh tenant only, maybe this is related to upgrading.

@SzymonSel
Copy link
Member Author

What OS are you on?

@gvkries
Copy link
Contributor

gvkries commented Jan 24, 2025

Windows

@SzymonSel
Copy link
Member Author

We're on MacOS and Linux.

@gvkries
Copy link
Contributor

gvkries commented Jan 24, 2025

There hasn't been a change on this particular part in OC:

https://github.com/OrchardCMS/OrchardCore/blame/9dfab0e2f78c339a4a621f86478bdf4055e667ca/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs#L316-L329

Are you sure you are not changing the user of the current request in between? I can't image how this should happen in OC on its own.

@SzymonSel
Copy link
Member Author

In between of what? In between the lines of the liquid template? :) No, we’re not :)

@gvkries
Copy link
Contributor

gvkries commented Jan 28, 2025

I'm also not able to reproduce this on Linux.

@gvkries
Copy link
Contributor

gvkries commented Jan 31, 2025

I'm still unable to reproduce it. There must be something in common in your apps, e.g. are they using the same features? Please provide us more details.

@SzymonSel
Copy link
Member Author

I'll try narrowing it down next week! Thanks!

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