Skip to content

Commit

Permalink
Rename functions to reflect renamed routes
Browse files Browse the repository at this point in the history
  • Loading branch information
DrGFreeman committed Nov 25, 2020
1 parent f544542 commit dc121a9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions securedrop/source_app/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def recommend_tor_browser() -> str:
return render_template("use-tor-browser.html")

@view.route('/public-key')
def download_journalist_pubkey() -> flask.Response:
def download_public_key() -> flask.Response:
journalist_pubkey = current_app.crypto_util.gpg.export_keys(
config.JOURNALIST_KEY)
data = BytesIO(journalist_pubkey.encode('utf-8'))
Expand All @@ -29,7 +29,7 @@ def download_journalist_pubkey() -> flask.Response:
as_attachment=True)

@view.route('/why-public-key')
def why_download_journalist_pubkey() -> str:
def why_download_public_key() -> str:
return render_template("why-public-key.html")

return view
6 changes: 3 additions & 3 deletions securedrop/source_templates/lookup.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ <h2 class="headline">{{ gettext('Submit Messages') }}</h2>

<p class="explanation extended-explanation">
{% if allow_document_uploads %}
{{ 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('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_public_key')) }}
{% else %}
{{ gettext('If you are already familiar with GPG, you can optionally encrypt your messages with our <a href="{url}" class="text-link">public key</a> before submission.').format(url=url_for('info.download_journalist_pubkey')) }}
{{ gettext('If you are already familiar with GPG, you can optionally encrypt your messages with our <a href="{url}" class="text-link">public key</a> before submission.').format(url=url_for('info.download_public_key')) }}
{% endif %}
{{ gettext('<a href="{url}" class="text-link">Learn more</a>.').format(url=url_for('info.why_download_journalist_pubkey')) }}</p>
{{ gettext('<a href="{url}" class="text-link">Learn more</a>.').format(url=url_for('info.why_download_public_key')) }}</p>

<hr class="no-line">

Expand Down
4 changes: 2 additions & 2 deletions securedrop/source_templates/why-public-key.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ <h1>{{ gettext("Why download the team's public key?") }}</h1>
<p>{{ gettext("If you are already familiar with the GPG encryption software, you may wish to encrypt your submissions yourself. To do so:") }}
<ol>
<li>{{ gettext('<a href="{url}">Download</a> the public key. It will be saved to a file called:
<p><code>{submission_key_fpr_filename}</code></p>').format(url=url_for('info.download_journalist_pubkey'), submission_key_fpr_filename=submission_key_fpr + '.asc')|safe }}</li>
<p><code>{submission_key_fpr_filename}</code></p>').format(url=url_for('info.download_public_key'), submission_key_fpr_filename=submission_key_fpr + '.asc')|safe }}</li>
<li>{{ gettext('Import it into your GPG keyring.') }}
<ul>
<li>{{ gettext('If you are using <a href="{url}">Tails</a>, you can double-click the <code>.asc</code> file you just downloaded and it will be automatically imported to your keyring.').format(url='https://tails.boum.org') }}</li>
<li>{{ gettext('If you are using macOS or Linux, open the terminal. You can import the key with:<p><code>gpg --import /path/to/{submission_key_fpr_filename}</code></p>').format(url_for('info.download_journalist_pubkey'), submission_key_fpr_filename=submission_key_fpr + '.asc')|safe }}</li>
<li>{{ gettext('If you are using macOS or Linux, open the terminal. You can import the key with:<p><code>gpg --import /path/to/{submission_key_fpr_filename}</code></p>').format(url_for('info.download_public_key'), submission_key_fpr_filename=submission_key_fpr + '.asc')|safe }}</li>
</ul>
</li>
<li>{{ gettext('Encrypt your submission. Open the terminal and enter this gpg command:') }}
Expand Down
4 changes: 2 additions & 2 deletions securedrop/tests/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def test_lookup(source_app):
text = resp.data.decode('utf-8')
assert "public key" in text
# download the public key
resp = app.get(url_for('info.download_journalist_pubkey'))
resp = app.get(url_for('info.download_public_key'))
text = resp.data.decode('utf-8')
assert "BEGIN PGP PUBLIC KEY BLOCK" in text

Expand Down Expand Up @@ -576,7 +576,7 @@ def test_why_use_tor_browser(source_app):

def test_why_journalist_key(source_app):
with source_app.test_client() as app:
resp = app.get(url_for('info.why_download_journalist_pubkey'))
resp = app.get(url_for('info.why_download_public_key'))
assert resp.status_code == 200
text = resp.data.decode('utf-8')
assert "Why download the team's public key?" in text
Expand Down

0 comments on commit dc121a9

Please sign in to comment.