Skip to content

Commit

Permalink
first pass through "/generate"
Browse files Browse the repository at this point in the history
  • Loading branch information
cfm committed Jul 14, 2021
1 parent 5d5f2fa commit ae56f49
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 27 deletions.
23 changes: 14 additions & 9 deletions securedrop/source_templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,45 @@
<body>
{% include 'banner_warning_flashed.html' %}

<div class="content">
<div class="container">
{% block header %}
<div id="header">
<header>
<a href="{% if 'logged_in' in session %}{{ url_for('main.lookup') }}{% else %}{{ url_for('main.index') }}{% endif %}" class="no-bottom-border">
{# FIXME:
<img src="{{ g.logo }}" class="logo small" alt="{{ g.organization_name }} | {{ gettext('SecureDrop Home') }}" width="250">
#}
{{ g.organization_name }} | {{ gettext('SecureDrop Home')}}
</a>
{% include 'locales.html' %}
</div>
</header>
{% endblock %}

<div class="panel selected">
<main>
{% if g.show_offline_message %}
<section>
<h1>{{ gettext("We're sorry, our SecureDrop is currently offline.") }}</h1>
<p>{{ gettext("Please try again later. Check our website for more information.") }}</p>
</section>
{% else %}

{% if 'logged_in' in session %}
<a href="{{ url_for('main.logout') }}" class="btn pull-right" id="logout">{{ gettext('LOG OUT') }}</a>
<nav>
<a href="{{ url_for('main.logout') }}" class="btn pull-right" id="logout">{{ gettext('LOG OUT') }}</a>
</nav>
{% endif %}

{# FIXME:
{% if not new_user%}
<hr class="no-line">
{% endif %}
#}

{% endif %}

{% block body %}{% endblock %}
</div>
</div>
</main>

{% block footer %}
{% include 'footer.html' %}
{% endblock %}
</div>
</body>
</html>
18 changes: 10 additions & 8 deletions securedrop/source_templates/footer.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<hr class="footer-separator">
<footer>
<div id="footer-powered-by">
<img id="footer-logo" src="{{url_for('static', filename='i/logo-footer.png') }}" alt="" width="20" height="23">{{ gettext('Powered by') }} <strong>SecureDrop {{ version }}</strong>.
</div>
<div id="footer-advisory">
<p id="footer-powered-by">
{# FIXME:
<img id="footer-logo" src="{{url_for('static', filename='i/logo-footer.png') }}" alt="" width="20" height="23">{{ gettext('Powered by') }}
#}
{{ gettext('Powered by') }} <strong>SecureDrop {{ version }}</strong>.
</p>
<p id="footer-advisory">
{{ gettext('Please note: Sharing sensitive documents may put you at risk, even when using Tor and SecureDrop.') }}
</div>
<div id="footer-fpf">
</p>
<p id="footer-fpf">
{{ gettext('SecureDrop is a project of Freedom of the Press Foundation.') }}
</div>
</p>
</footer>
26 changes: 18 additions & 8 deletions securedrop/source_templates/generate.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,43 @@
{% block body %}
<h1>{{ gettext('Welcome') }}</h1>

<aside class="center">
<p>{{ gettext('Please either write this codename down and keep it in a safe place, or memorize it.') }}</p>
</aside>
{# FIXME: aside.center #}
<p id="codename-instructions" class="center">{{ gettext('Please either write this codename down and keep it in a safe place, or memorize it.') }}</p>

<p class="explanation">{{ gettext('This codename is what you will use in future visits to receive messages from our team in response to what you submit on the next screen.') }}</p>
<p id="codename-explanation" class="explanation">{{ gettext('This codename is what you will use in future visits to receive messages from our team in response to what you submit on the next screen.') }}</p>

{# FIXME:
<hr class="no-line">
#}

<div class="code">
<section class="code">
{# FIXME:
<img class="pull-left" src="{{ url_for('static', filename='i/font-awesome/lock-black.png') }}" alt="" width="20" height="23">
<p id="codename" class="codename">{{ codename }}</p>
#}
<label id="codename-label" for="codename" hidden>{{ gettext('Codename') }}</label>
<output id="codename" class="codename" aria-labelledby="codename-label" aria-describedby="codename-instructions codename-explanation">{{ codename }}</output>
<div class="pull-right">

<form id="regenerate-form" method="post">
<input name="csrf_token" type="hidden" value="{{ csrf_token() }}">
<button type="submit" id="regenerate-submit" class="small">
{# FIXME:
<img class="icon pull-left off-hover" src="{{ url_for('static', filename='i/font-awesome/refresh-white.png') }}" alt="{{ gettext('Refresh codename') }}" width="20" height="20">
<img class="icon pull-left on-hover" src="{{ url_for('static', filename='i/font-awesome/refresh-white.png') }}" alt="{{ gettext('Refresh codename') }}" width="20" height="20">
#}
{{ gettext('Refresh codename') }}
</button>
</form>
</div>
<div class="clearfix"></div>
</section>
{# FIXME:
<div class="clearfix"></div>
</div>

<div class="clearfix"></div>

<hr class="no-line">

#}
<p class="explanation">{{ gettext('Because we do not track users of our <strong>SecureDrop</strong>
service, in future visits, using this codename will be the only way we have to communicate with you should we have
questions or are interested in additional information. Unlike passwords, there is no way to retrieve a lost codename.') }}
Expand All @@ -40,6 +49,7 @@ <h1>{{ gettext('Welcome') }}</h1>
<input name="csrf_token" type="hidden" value="{{ csrf_token() }}">
<input name="tab_id" type="hidden" value="{{ tab_id }}">
<button type="submit" class="btn--space pull-right" id="continue-button">
{# FIXME: #6003 #}
{{ gettext('SUBMIT DOCUMENTS') }}
</button>
</form>
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 @@ -101,8 +101,8 @@ def _find_codename(html):
"""Find a source codename (diceware passphrase) in HTML"""
# Codenames may contain HTML escape characters, and the wordlist
# contains various symbols.
codename_re = (r'<p [^>]*id="codename"[^>]*>'
r'(?P<codename>[a-z0-9 &#;?:=@_.*+()\'"$%!-]+)</p>')
codename_re = (r'<output [^>]*id="codename"[^>]*>'
r'(?P<codename>[a-z0-9 &#;?:=@_.*+()\'"$%!-]+)</output>')
codename_match = re.search(codename_re, html)
assert codename_match is not None
return codename_match.group('codename')
Expand Down

0 comments on commit ae56f49

Please sign in to comment.