User changes their password but can still access their notes using both old and new passwords.
How to Reproduce
Add a flag -update (boolean) to user sets of flags
change the logic in the userCmd function to:
if f.update == true -> update password of an existing user
else -> create a new user
Create a new user
go run ./cmd/test user -password pear -id rita123 - creates a user rita123 with password 'pear'
Create a note for this user
go run ./cmd/test note -owner rita123 -content "This is my note about pear" - creates a note for user rita123 with content "This is my note about pear"
Update the user's password
go run ./cmd/test user -password orange -id rita123 -update - updates password to orange for user rita123
using Postman create a GET request to 127.0.0.1:8090/1/my/notes.json with basic authentication for the user rita123 and old password pear
Expected Behavior
Expected to see an unauthorized response
Describe the Bug
User changes their password but can still access their notes using both old and new passwords.
How to Reproduce
Add a flag
-update
(boolean) to user sets of flags change the logic in theuserCmd
function to: iff.update == true
-> update password of an existing user else -> create a new userCreate a new user
go run ./cmd/test user -password pear -id rita123
- creates a user rita123 with password 'pear'Create a note for this user
go run ./cmd/test note -owner rita123 -content "This is my note about pear"
- creates a note for user rita123 with content "This is my note about pear"Update the user's password
go run ./cmd/test user -password orange -id rita123 -update
- updates password toorange
for userrita123
using Postman create a GET request to 127.0.0.1:8090/1/my/notes.json with basic authentication for the user
rita123
and old passwordpear
Expected Behavior Expected to see an unauthorized response
Actual Behaviour
Receiving actual notes with old password
pear
Receiving actual notes with new password
orange