🚸 Remove URL encoding from token

This commit is contained in:
Emilien GUILMINEAU 2024-03-30 20:46:02 +01:00
parent 04235c1edc
commit b69290425a
2 changed files with 5 additions and 3 deletions

View file

@ -152,6 +152,7 @@ This will return a JSON response with a token and the password link:
{ {
"token": "snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D", "token": "snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D",
"token": "snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY=",
"links": [{ "links": [{
"rel": "self", "rel": "self",
"href": "http://127.0.0.1:5000/api/v2/passwords/snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D", "href": "http://127.0.0.1:5000/api/v2/passwords/snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D",
@ -187,7 +188,7 @@ Otherwise, the API will return a 404 (Not Found) response like so:
Check if a password exists Check if a password exists
"""""""""""""""""""""""""" """"""""""""""""""""""""""
To check if a password exists, send a HEAD request to ``/api/v2/passwords/<password_key>``, where ``<password_key>`` is the token of the API response when a password is created, or simply use the `self` link: To check if a password exists, send a HEAD request to ``/api/v2/passwords/<token>``, where ``<token>`` is the token of the API response when a password is created (url encoded), or simply use the `self` link:
:: ::
@ -233,9 +234,9 @@ To read a password, send a GET request to ``/api/v2/passwords/<password_key>``,
$ curl -X GET http://localhost:5000/api/v2/passwords/snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D $ curl -X GET http://localhost:5000/api/v2/passwords/snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D
If : If :
- the passwork_key is valid - the token is valid
- the password : - the password :
- exists, - exists
- has not been read - has not been read
- is not expired - is not expired

View file

@ -285,6 +285,7 @@ def api_v2_set_password():
link = urljoin(base_url, request.path + "/" + url_token) link = urljoin(base_url, request.path + "/" + url_token)
response_content = { response_content = {
"token": url_token, "token": url_token,
"token": token,
"links": [{ "links": [{
"rel": "self", "rel": "self",
"href": link "href": link