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

[Frontend] Current user shows freshly created user instead of admin user #470

Open
m-danya opened this issue Oct 13, 2024 · 4 comments
Open
Labels
bug Something isn't working

Comments

@m-danya
Copy link

m-danya commented Oct 13, 2024

Describe the bug

After creating a user from admin panel, the "Current user" widget shows the freshly created user instead of admin user.

See the gif below:
fief-frontend-bug

To Reproduce

Steps to reproduce the behavior:

Follow quickstart from docs with ghcr.io/fief-dev/fief:0.28.9 (latest is not working rn, see #469).
Go to /admin, create user, check the current user widget in right top corner. It's not the admin user anymore.

Expected behavior

The current user widget does not change after creating new user in admin panel.

Configuration

  • Cloud or self-hosted: self-hosted
  • If self-hosted, Fief version: 0.28.9
@m-danya m-danya added the bug Something isn't working label Oct 13, 2024
Copy link

fief-bailiff bot commented Oct 13, 2024

Hail, @m-danya 👋 Welcome to Fief's kingdom!

Our team will get back to you very soon to help.

In the meantime, take a minute to star our repository ⭐️

star-fief

Want to support us?

Subscribe to one of our paid plan to help us continue our work and receive exclusive information and benefits! Starts at $5/month 🪙

Subscribe

Farewell!

@m-danya m-danya changed the title [Frontend] Current user shows freshly user instead of admin user [Frontend] Current user shows freshly created user instead of admin user Oct 13, 2024
@frankie567
Copy link
Member

Oh, that's a fun one :) When editing a user in the admin dashboard, we set a user variable in the template context, but then it overrides the actual authenticated user from BaseContext:

@router.get("/{id:uuid}", name="dashboard.users:get")
async def get_user(
request: Request,
user: User = Depends(get_user_by_id_or_404),
list_context=Depends(get_list_context),
context: BaseContext = Depends(get_base_context),
):
return templates.TemplateResponse(
request,
"admin/users/get/account.html",
{**context, **list_context, "user": user, "tab": "account"},
)

We probably should have a more specific name like authenticated_user for the actual admin user.

@thzjy
Copy link

thzjy commented Nov 6, 2024

Follow quickstart from docs with ghcr.io/fief-dev/fief:0.29.2

Go to /admin, it return

http://0.0.0.0:8000/authorize?response_type=code&client_id=hUFBbjj4dKu5QV_zljhDMsiCO2hjMlcu8ErCCEcfH1Q&redirect_uri=http%3A%2F%2F192.168.232.128%3A8000%2Fadmin%2Fauth%2Fcallback&scope=openid&screen=login

error page,not redirect to login page

Go to/login ,I can login with start up user, but the user is not a admin, it can not access dashboard, only user info page.

Cloud or self-hosted: self-hosted
If self-hosted, Fief version: 0.29.2

@NikitaDergunov
Copy link

@thzjy I think we are having the same issue -> #502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

4 participants