Skip to content

Commit

Permalink
feat(/lookup): if uploads are disallowed, remove most UI references t…
Browse files Browse the repository at this point in the history
…o files
  • Loading branch information
wbaid committed Sep 29, 2019
1 parent de4553a commit 45839df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions securedrop/source_templates/lookup.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
{% endif %}
</div>

{% if allow_document_uploads %}
<h2 class="headline">{{ gettext('Submit Files or Messages') }}</h2>
<p class="explanation">{{ gettext('You can submit any kind of file, a message, or both.') }}</p>
{% else %}
<h2 class="headline">{{ gettext('Submit Messages') }}</h2>
{% endif %}

<p class="explanation extended-explanation">{{ gettext('If you are already familiar with GPG, you can optionally encrypt your files and messages with our <a href="{url}" class="text-link">public key</a> before submission. Files are encrypted as they are received by SecureDrop.').format(url=url_for('info.download_journalist_pubkey')) }}
{{ gettext('<a href="{url}" class="text-link">Learn more</a>.').format(url=url_for('info.why_download_journalist_pubkey')) }}</p>
Expand Down
13 changes: 13 additions & 0 deletions securedrop/tests/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,19 @@ def test_lookup(source_app):
assert "BEGIN PGP PUBLIC KEY BLOCK" in text


def test_no_allow_document_upload(source_app):
"""Test /lookup page with ALLOW_DOCUMENT_UPLOADS = False"""
source_app.sdconfig.ALLOW_DOCUMENT_UPLOADS = False
with source_app.test_client() as app:
codename = new_codename(app, session)
resp = app.post(url_for('main.login'), data=dict(codename=codename),
follow_redirects=True)
# redirects to /lookup
# check for messages-only heading
text = resp.data.decode('utf-8')
assert "Submit Messages" in text


def test_login_and_logout(source_app):
with source_app.test_client() as app:
resp = app.get(url_for('main.login'))
Expand Down

0 comments on commit 45839df

Please sign in to comment.