🚸 Add a link to web view
Allowing usage of the password into a subsystem which target human
This commit is contained in:
parent
b69290425a
commit
e4803977c0
2 changed files with 9 additions and 4 deletions
|
@ -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=",
|
"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",
|
||||||
|
},{
|
||||||
|
"rel": "web-view",
|
||||||
|
"href": "http://127.0.0.1:5000/snappassbedf19b161794fd288faec3eba15fa41~hHnILpQ50ZfJc3nurDfHCb_22rBr5gGEya68e_cZOrY%3D",
|
||||||
}],
|
}],
|
||||||
"ttl":1209600
|
"ttl":1209600
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,13 +282,16 @@ def api_v2_set_password():
|
||||||
token = set_password(password, ttl)
|
token = set_password(password, ttl)
|
||||||
url_token = quote_plus(token)
|
url_token = quote_plus(token)
|
||||||
base_url = set_base_url(request)
|
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 = {
|
response_content = {
|
||||||
"token": url_token,
|
|
||||||
"token": token,
|
"token": token,
|
||||||
"links": [{
|
"links": [{
|
||||||
"rel": "self",
|
"rel": "self",
|
||||||
"href": link
|
"href": api_link
|
||||||
|
}, {
|
||||||
|
"rel": "web-view",
|
||||||
|
"href": web_link
|
||||||
}],
|
}],
|
||||||
"ttl": ttl
|
"ttl": ttl
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue