Coder Social home page Coder Social logo

actix_login's Issues

Why can I keep updating password even after logout?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.