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

Issue when logging out #141

Closed
4 tasks done
JunkyardCat opened this issue Apr 9, 2024 · 11 comments
Closed
4 tasks done

Issue when logging out #141

JunkyardCat opened this issue Apr 9, 2024 · 11 comments
Labels
needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. question

Comments

@JunkyardCat
Copy link

Before submitting the issue, confirm that you've checked everything in the following list, and mark them as completed here:

  • Issue is reproducible on this repository by following the quick-start instructions.
  • A clean/fresh database was used when the issue was encountered.
  • Information about the environment setup when the issue was encountered is included in the issue.
  • Output logs are included in the issue.

What was incorrect, unhelpful, or unexpected?

so i followed the guide up till this part where it tests the logout (using the side bar but when i was logged out it displays the admin logout page and when i went back to home page it didn't even log out the user
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication#testing_the_new_authentication_pages

What did you expect to see?

user logged out page found in logged_out.html and also user properly logged out.

Output logs

No response

Do you have anything more you want to share?

No response

@JunkyardCat JunkyardCat added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Apr 9, 2024
Copy link

github-actions bot commented Apr 9, 2024

It looks like this is your first issue. Welcome! 👋 One of the project maintainers will be with you as soon as possible. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct.

@hamishwillee
Copy link
Collaborator

Thank you. Have you tried THIS repo version - and do you find the same problem? If you do, is your environment the same as the one in this project requirement.txt? If not, then you should compare your code to this project to help us isolate what is different.

@JunkyardCat
Copy link
Author

i don't think it matters if the repo is correct or not i just want to know if following the tutorial would produce the result I stated above. is this the right place to raise this kind of issue (the site that i just mentioned)

@hamishwillee
Copy link
Collaborator

Yes it does matter if this repo is correct or not. Almost all issues raised with this tutorial prove to be people not following the instructions properly.
This tutorial was created by following the tutorial properly. So if you can get this tutorial to work you can difference to find your errors. If you can't then it may be that there is indeed an error or some problem with the tutorial.

Yes, this is a good place to raise an issue with the tutorial, or you can raise in the mdn/content repository - either way, you'll come back to here, because I can't debug "it just doesn't work" as easily as I can debug "please compare to this working project".

@JunkyardCat
Copy link
Author

then ye it is the same as the one in the repo

@hamishwillee
Copy link
Collaborator

Thanks. I'll test that tomorrow then to verify.

@hamishwillee
Copy link
Collaborator

My testing shows the version in this repo works perfectly if you follow the instructions. When I log out I get this screen, and navigating shows that we are indeed logged out:

image

Note that I tried this on Python 3.10 and loaded the requirements as listed in the above instructions.

The link you provided above is https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication#testing_the_new_authentication_pages , which clearly states that at this point the logout won't work. Is it possible that you did not get as far as the next section and implement the https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication#testing_in_templates ?

The next steps to debug would be for you to try this repo again. If you can't get it working there is something wrong with your environment.

@JunkyardCat
Copy link
Author

The link you provided above is https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication#testing_the_new_authentication_pages , which clearly states that at this point the logout won't work. Is it possible that you did not get as far as the next section and implement the https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication#testing_in_templates ?

im using python 3.11

yes i have done the "testing in templates" part where i appended the changes to base_generics.html

<form id="logout-form" method="post" action="{% url 'admin:logout' %}">

i see. the thing that i didnt understand was this line above. was wondering what the line above would do? will it direct to admin logout?

@JunkyardCat
Copy link
Author

any update on this?

@hamishwillee
Copy link
Collaborator

Sorry, I missed this response.

i see. the thing that i didnt understand was this line above. was wondering what the line above would do? will it direct to admin logout?

It redirects to the registered "logged_out.html" template - in this case: https://github.com/mdn/django-locallibrary-tutorial/blob/main/templates/registration/logged_out.html

Prior to Django 5 you would use a GET (url) rather than a POST (form). If you use a GET in Django 5 you may get redirected to the admin logout but you won't be logged out.

To spell this out I have made this minor modification: #141

I'm closing this as "Not a defect" since this works.

@hamishwillee
Copy link
Collaborator

@JunkyardCat I've done some further investigation following on from another discussion. I suspect I was wrong in my response to this - it works for superuser but not for normal users.

Anyway, should be fixed now by mdn/content#33385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. question
Projects
None yet
Development

No branches or pull requests

3 participants