diff --git a/README.rst b/README.rst index 8c55ce5..6e98da7 100644 --- a/README.rst +++ b/README.rst @@ -151,11 +151,13 @@ This will return a JSON response with a token and the password link: :: { - "token": "snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D", "token": "snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY=", "links": [{ "rel": "self", "href": "http://127.0.0.1:5000/api/v2/passwords/snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D", + },{ + "rel": "web-view", + "href": "http://127.0.0.1:5000/snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D", }], "ttl":1209600 } diff --git a/snappass/main.py b/snappass/main.py index 9b04690..6f06572 100644 --- a/snappass/main.py +++ b/snappass/main.py @@ -282,13 +282,16 @@ def api_v2_set_password(): token = set_password(password, ttl) url_token = quote_plus(token) base_url = set_base_url(request) - link = urljoin(base_url, request.path + "/" + url_token) + api_link = urljoin(base_url, request.path + "/" + url_token) + web_link = urljoin(base_url, url_token) response_content = { - "token": url_token, "token": token, "links": [{ "rel": "self", - "href": link + "href": api_link + }, { + "rel": "web-view", + "href": web_link }], "ttl": ttl }