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

Why can I keep updating password even after logout? #1

Open
yjiangnan opened this issue Dec 26, 2020 · 0 comments
Open

Why can I keep updating password even after logout? #1

yjiangnan opened this issue Dec 26, 2020 · 0 comments

Comments

@yjiangnan
Copy link

Hi, I almost copied your code to build a server. I can register users, and login only if the password is correct. Then I receive the authentication cookie. However, when I use the cookie to request new urls such as update_password, it seems that I can keep doing it even after I logout:

Jiang-Nans-MacBook-Retina:backend jiangnan$ curl -i --request GET --url http://127.0.0.1:9433/api/auth/logout -H 'Cookie: auth=b8bPZB3TU8MamnU9pWcEkBCEPRRLRXUesKFL51ifnFQ1hV4Hwd3DKF9jPuOKbJbT;'
HTTP/1.1 200 OK
content-length: 0
set-cookie: auth=; HttpOnly; Path=/; Domain=localhost; Max-Age=0; Expires=Fri, 27 Dec 2019 08:25:02 GMT
date: Sat, 26 Dec 2020 08:25:02 GMT

Jiang-Nans-MacBook-Retina:backend jiangnan$ curl -i --request POST   --url http://127.0.0.1:9433/api/auth/update_password --header 'content-type: application/json;' -H 'Cookie: auth=b8bPZB3TU8MamnU9pWcEkBCEPRRLRXUesKFL51ifnFQ1hV4Hwd3DKF9jPuOKbJbT;' --data '{
        "old_password": "12345",
        "new_password":"12345"
}'
HTTP/1.1 200 OK
content-length: 0
set-cookie: auth=NBq6sx5B5vgexv0N3R3gmGTju5BS4Y2tn7JGhVQi5hU8hIVLYgBYAi9TfWOajrC/; HttpOnly; Path=/; Domain=localhost; Max-Age=86400
date: Sat, 26 Dec 2020 08:25:21 GMT

In the debug mode, I can confirm that id.forget(); in the logout function has indeed been run and the id.id field is set to None. However, there seems to be no real effect after that since I can call the logout API again and again. By the way, where is data for username and cookie saved? Why is cookie still valid even after I restart the server? How can I use the authentication cookie correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant