karthickai / actix_login Goto Github PK
View Code? Open in Web Editor NEWRUST, Actix, Login, Bcrypt, Diesel, SQLite
License: MIT License
RUST, Actix, Login, Bcrypt, Diesel, SQLite
License: MIT License
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.