]> git.ipfire.org Git - thirdparty/patchwork.git/commit
views: Don't render token section of user profile if REST API disabled
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Tue, 19 Dec 2017 05:41:27 +0000 (16:41 +1100)
committerStephen Finucane <stephen@that.guru>
Thu, 4 Jan 2018 11:31:58 +0000 (11:31 +0000)
commitcc1d5c5cd1076a26c4ed2d0cd9383bba86e7c8a2
tree3971f00a89677ae480e0d8ce8a1ab4676cf8cb04
parent6bc9985e875db865fe63c2e763301bd25101449f
views: Don't render token section of user profile if REST API disabled

In profile.html, if settings.ENABLE_REST_API == False, trying to render a
link to the generate_token page will raise a NoReverseMatch exception, so
we shouldn't render that. In any case, if the REST API is disabled, we
really shouldn't render the API token section of the page at all.

Only render the API token and generation link if settings.ENABLE_REST_API
is True.

Reported-by: Tomas Novotny <tomas@novotny.cz>
Closes: #138 ("NoReverseMatch exception on user login with disabled REST API")
Fixes: 85c8f369204a ("views: Provide a way to view, (re)generate tokens")
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit 14034e8a44a497d32f56f31a0fdc4473336d92af)
patchwork/templates/patchwork/profile.html
patchwork/views/user.py