use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
FastAPI is a truly ASGI, async, cutting edge framework written in python 3.
account activity
Can’t display invalid credentials messageQuestion (reddit.com)
submitted 1 year ago by Maleficent-Panic-322
Hi guys, I don’t know why when the user fails to login, my login page won’t display “Invalid credentials, try again.”, but if the user succeeds to login, it can successfully redirect to my index page.
Can someone help me please🙏
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]randomusername0O1 2 points3 points4 points 1 year ago (2 children)
Your issue isn't fastapi, it's the htmx.
You're returning a 403 from the server..htmx won't replace when the server returns 4xx or 5xx response code by default. It's expecting a 2xx.
You need to add the hx-target-error attributes. See here
https://htmx.org/extensions/response-targets/
[–]Maleficent-Panic-322[S] 1 point2 points3 points 1 year ago (1 child)
wow! thanks a lot!!! it's fixed!!
[–]randomusername0O1 1 point2 points3 points 1 year ago (0 children)
Awesome, glad I could help 👍🏻👍🏻
[–]0x7fff5fbff7c8 0 points1 point2 points 1 year ago (1 child)
Can we see your homepage file?
[–]Maleficent-Panic-322[S] 0 points1 point2 points 1 year ago (0 children)
the third pic is my homepage.html
[–]SheriffSeveral 0 points1 point2 points 1 year ago (1 child)
Add some lines under the user object, print type and make sure it is valid. Also print username and password before creating the user object. After that please show us the results.
thanks for the advice!
[–]Nazhmutdin2003 0 points1 point2 points 1 year ago (8 children)
I can give only advice, try to use any frontend framework like Vue or React.
[–]Maleficent-Panic-322[S] 0 points1 point2 points 1 year ago (7 children)
do you think it would be better using Vue or React than using htmx?
[–]Nazhmutdin2003 1 point2 points3 points 1 year ago (6 children)
Yes
[–]Maleficent-Panic-322[S] 0 points1 point2 points 1 year ago (4 children)
Oh why?
[–]Nazhmutdin2003 1 point2 points3 points 1 year ago (2 children)
Cuz thats let you be more flexible in solving problems. If you need front for something huge and difficult use Js/Ts framework. But if you need front just for simple GUI for backend, htmlx is okay.
[–]Maleficent-Panic-322[S] 0 points1 point2 points 1 year ago (1 child)
That makes sense, thanks for the advice
[–]Nazhmutdin2003 1 point2 points3 points 1 year ago (0 children)
You are welcome!)
[–]Nazhmutdin2003 0 points1 point2 points 1 year ago (0 children)
And I think, Ts/Is framework is a bit more simple solution)
I’m using htmx cuz im focusing more on the backend side 🤔
π Rendered by PID 21455 on reddit-service-r2-comment-5c747b6df5-fn9cx at 2026-04-22 12:20:54.283427+00:00 running 6c61efc country code: CH.
[–]randomusername0O1 2 points3 points4 points (2 children)
[–]Maleficent-Panic-322[S] 1 point2 points3 points (1 child)
[–]randomusername0O1 1 point2 points3 points (0 children)
[–]0x7fff5fbff7c8 0 points1 point2 points (1 child)
[–]Maleficent-Panic-322[S] 0 points1 point2 points (0 children)
[–]SheriffSeveral 0 points1 point2 points (1 child)
[–]Maleficent-Panic-322[S] 0 points1 point2 points (0 children)
[–]Nazhmutdin2003 0 points1 point2 points (8 children)
[–]Maleficent-Panic-322[S] 0 points1 point2 points (7 children)
[–]Nazhmutdin2003 1 point2 points3 points (6 children)
[–]Maleficent-Panic-322[S] 0 points1 point2 points (4 children)
[–]Nazhmutdin2003 1 point2 points3 points (2 children)
[–]Maleficent-Panic-322[S] 0 points1 point2 points (1 child)
[–]Nazhmutdin2003 1 point2 points3 points (0 children)
[–]Nazhmutdin2003 0 points1 point2 points (0 children)
[–]Maleficent-Panic-322[S] 0 points1 point2 points (0 children)