Replies: 2 comments 6 replies
-
|
I think it would be tricky - the login is handled by this: piccolo_admin/piccolo_admin/endpoints.py Line 775 in 55c3ec7 Because of the way the code is structured, it makes it hard to override. The auth needs decoupling more from the admin more to make this easier. You might be able to wrap the entire admin panel in some ASGI middleware, detect when the login endpoint is called, and perform additional logic? |
Beta Was this translation helpful? Give feedback.
-
|
I came back to this after some time not thinking about it and figured out a really simple solution I had totally overlooked. By moving my auth checks to before the admin page is loaded it works perfect for my use case. The following example is all I need to achieve this: @asgi("/admin/", is_mount=True, copy_scope=True)
async def admin(scope: "Scope", receive: "Receive", send: "Send") -> None:
request = Request(scope, receive, send)
await EnsureAuth.get_user_from_connection(request, possible_redirect="/admin/")
await configure_piccolo_admin()(scope, receive, send)Where |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
My base application has a lot of features for authentication that the admin panel doesnt mirror (and thats okay). Is there a way that instead of using the built in auth form, I can redirect users to a custom link on no auth?
I am happy to subclass things if it means I can make this happen
Beta Was this translation helpful? Give feedback.
All reactions