summaryrefslogtreecommitdiff
path: root/patchwork/templates
diff options
context:
space:
mode:
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>2017-12-19 16:41:27 +1100
committerStephen Finucane <stephen@that.guru>2018-01-04 11:29:58 +0000
commit14034e8a44a497d32f56f31a0fdc4473336d92af (patch)
treebe563f3cd93471f7a6f92d92cec3415d67e54dce /patchwork/templates
parent8ac8e7a618e0c94a7d2c9aacb3c005949b3cb694 (diff)
downloadpatchwork-14034e8a44a497d32f56f31a0fdc4473336d92af.tar
patchwork-14034e8a44a497d32f56f31a0fdc4473336d92af.tar.gz
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>
Diffstat (limited to 'patchwork/templates')
-rw-r--r--patchwork/templates/patchwork/profile.html2
1 files changed, 2 insertions, 0 deletions
diff --git a/patchwork/templates/patchwork/profile.html b/patchwork/templates/patchwork/profile.html
index 75c4f59..4ca78da 100644
--- a/patchwork/templates/patchwork/profile.html
+++ b/patchwork/templates/patchwork/profile.html
@@ -140,6 +140,7 @@ address.</p>
<th>Password:</th>
<td><a href="{% url 'password_change' %}">Change password</a>
</tr>
+{% if rest_api_enabled %}
<tr>
<th>API Token:</th>
<td>
@@ -162,6 +163,7 @@ address.</p>
</form>
</td>
</tr>
+{% endif %}
</table>
</div>