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

Added action to allow POST without JS #385

Merged
merged 8 commits into from
Jun 3, 2024
Merged

Conversation

Domejko
Copy link
Contributor

@Domejko Domejko commented May 24, 2024

Description

Regarding #376

  • Added action="{% url 'auth:login manual' %}" to html form so that when JS is disabled code will default to action instead of using hx.

Checklist

  • Ran the Black Formatter and
    djLint-er on any new code
    (checks
    will
    fail without)
  • Made any changes or additions to the documentation where required
  • Changes generate no new warnings/errors
  • New and existing unit tests pass locally with my
    changes

What type of PR is this?

  • 🐛 Bug Fix
  • ♻️ Code Refactor

Added/updated tests?

  • 🙅 no, because they aren't needed

Related PRs, Issues etc

@TreyWW TreyWW self-assigned this May 24, 2024
@TreyWW
Copy link
Owner

TreyWW commented May 25, 2024

This doesn't seem to be working. Did it work for you?

@TreyWW
Copy link
Owner

TreyWW commented May 25, 2024

Ah; as we redirect when the user doesn't use HTMX this doesn't make sense to implement.

    if not request.htmx:
        return redirect("auth:login")

As the user is just stuck with an infinite loop

@Domejko
Copy link
Contributor Author

Domejko commented May 25, 2024

Yes, I just made it work in shape and form as it is now without errors.

Basically it comes down now to what's is the desired functionality ? Because if website is supposed to be fully functional without JS then we would need to refactor most of html files since many of them use hx-*, and some backend files also got checks for request.htmx. Without it many functions will just not work and I think that it would be a bad idea to give users access to half baked website.
If not then I would keep if not request.htmx: and additionally inform user that he have JS disabled and since this website use JS ask him to enable it. I assume that cases when someone try to use internet without JS are very extreme this days.

@TreyWW
Copy link
Owner

TreyWW commented May 25, 2024

Yeah I agree with that. It's probably easier to just stick with the idea of users have to have JS enabled, otherwise like you say the whole site wont work. Every page (pretty much) has some reliability on HTMX, and I'd rather not have to make all of it work without it. Maybe a popup saying you need JS could be a good option - that way this bug wont ever occur. We could just add a message before we redirect them to help a little too

@Domejko
Copy link
Contributor Author

Domejko commented May 27, 2024

@TreyWW I have added a popup with short info to enable JS and hyperlink to instructions how to do it on different browsers. It activates only when JS is disabled and someone enters login page. I didn't add possibility to close window since website either way wont be functional without JS.

Preview:
Screenshot from 2024-05-27 16-18-13

@TreyWW
Copy link
Owner

TreyWW commented May 27, 2024

Nice, I'd rather we use DaisyUI and tailwind though please. Since they have built in components that will do this and will keep the colour theme synced and styling consistent

@Domejko
Copy link
Contributor Author

Domejko commented May 27, 2024

I have utilized available classes to sync color, font theme and size. Only .popup class left since Tailwind don't provide popup class.

Preview:
Screenshot from 2024-05-27 17-16-32

@TreyWW
Copy link
Owner

TreyWW commented May 28, 2024

needs to have ran py manage.py lint

@TreyWW TreyWW merged commit 4c9034a into TreyWW:main Jun 3, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✔ Done
Development

Successfully merging this pull request may close these issues.

bug: Logging in without HTMX gives error
2 participants