summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-04-22 15:49:16 +0200
committerFlorian Dold <florian@dold.me>2021-04-22 15:50:23 +0200
commit51f25b62eb6447a48c139e04ea73e8fe811227a4 (patch)
tree9b6b4b55f6be196dfb1b9f0fa8963a74cb90a6b8
parent8663a5a15b8f9d57757f70fa16e2a7460e9056ee (diff)
downloadbank-51f25b62eb6447a48c139e04ea73e8fe811227a4.tar.gz
bank-51f25b62eb6447a48c139e04ea73e8fe811227a4.tar.bz2
bank-51f25b62eb6447a48c139e04ea73e8fe811227a4.zip
Use same base template as merchant demos.
-rw-r--r--talerbank/app/static/logo-white.svg45
-rw-r--r--talerbank/app/templates/404.html27
-rw-r--r--talerbank/app/templates/base.html131
-rw-r--r--talerbank/app/templates/common_base.html94
-rw-r--r--talerbank/app/templates/login.html9
-rw-r--r--talerbank/app/templates/payto_wiretransfer.html12
-rw-r--r--talerbank/app/templates/profile_page.html5
-rw-r--r--talerbank/app/templates/public_accounts.html7
-rw-r--r--talerbank/app/templates/register.html27
-rw-r--r--talerbank/app/templates/withdraw_confirm.html24
-rw-r--r--talerbank/app/templates/withdraw_show.html37
-rw-r--r--talerbank/cli.py11
-rw-r--r--talerbank/jinja2.py61
-rw-r--r--talerbank/settings.py61
14 files changed, 272 insertions, 279 deletions
diff --git a/talerbank/app/static/logo-white.svg b/talerbank/app/static/logo-white.svg
new file mode 100644
index 0000000..cb1f023
--- /dev/null
+++ b/talerbank/app/static/logo-white.svg
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="670"
+ height="300"
+ viewBox="0 0 201 90"
+ version="1.1"
+ id="svg8">
+ <g
+ id="logo">
+ <g
+ id="circles"
+ style="fill:#FFF;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.327943">
+ <path
+ d="m 86.662153,1.1211936 c 15.589697,0 29.129227,9.4011664 35.961027,23.2018054 h -5.81736 C 110.4866,13.623304 99.349002,6.5180852 86.662153,6.5180852 c -19.690571,0 -35.652876,17.1120008 -35.652876,38.2205688 0,10.331797 3.825597,19.704678 10.03957,26.582945 -1.342357,1.120912 -2.771532,2.127905 -4.275488,3.006754 C 50.071485,66.553412 45.974857,56.15992 45.974857,44.738654 c 0,-24.089211 18.216325,-43.6174604 40.687296,-43.6174604 z M 122.51416,65.375898 c -6.86645,13.680134 -20.34561,22.980218 -35.852007,22.980218 -1.052702,0 -2.096093,-0.04291 -3.128683,-0.127026 3.052192,-1.561167 5.913582,-3.480387 8.538307,-5.707305 10.320963,-1.684389 19.185983,-8.113638 24.601813,-17.145887 z"
+ id="path2350" />
+ <path
+ d="m 64.212372,1.1211936 c 1.052607,0 2.095998,0.042919 3.128684,0.1270583 C 64.288864,2.8094199 61.427378,4.728606 58.802653,6.9555572 41.679542,9.7498571 28.559494,25.601563 28.559494,44.738654 c 0,14.264563 7.29059,26.702023 18.093843,33.268925 -1.593656,0.26719 -3.226966,0.406948 -4.890748,0.406948 -1.239545,0 -2.46151,-0.07952 -3.663522,-0.229364 C 29.191129,70.184015 23.525076,58.171633 23.525076,44.738654 23.525076,20.649443 41.7414,1.1211936 64.212372,1.1211936 Z M 69.62209,82.521785 C 79.943207,80.837396 88.808164,74.407841 94.224059,65.375422 h 5.840511 c -6.866354,13.680305 -20.345548,22.980694 -35.852198,22.980694 -1.052703,0 -2.095999,-0.04291 -3.128684,-0.127026 3.052002,-1.561371 5.913836,-3.480218 8.538402,-5.707305 z M 94.355885,24.322999 c -3.13939,-5.314721 -7.467551,-9.74275 -12.584511,-12.853269 1.593656,-0.26719 3.226904,-0.406948 4.890779,-0.406948 1.239451,0 2.461512,0.07952 3.663524,0.229364 4.016018,3.607242 7.373195,8.030111 9.849053,13.030853 z"
+ id="path2352" />
+ <path
+ d="m 41.762589,1.1211936 c 1.064296,0 2.118804,0.044379 3.162607,0.1302161 -3.046523,1.558961 -5.903162,3.4745139 -8.52358,5.6968133 C 19.254624,9.7205882 6.1097128,25.583465 6.1097128,44.738654 c 0,21.108568 15.9624012,38.22057 35.6528762,38.22057 12.599746,0 23.672446,-7.007056 30.013748,-17.583802 h 5.838515 C 70.748498,79.055727 57.26924,88.356116 41.762589,88.356116 c -22.470907,0 -40.6871998,-19.52825 -40.6871998,-43.617462 0,-24.089211 18.2162928,-43.6174604 40.6871998,-43.6174604 z M 71.905375,24.322999 c -1.31192,-2.220567 -2.830984,-4.287049 -4.528877,-6.166508 1.342452,-1.120945 2.771374,-2.128381 4.275139,-3.00723 2.372984,2.753011 4.418875,5.834636 6.072489,9.173738 z"
+ id="path2354" />
+ </g>
+ <g
+ id="letters"
+ style="fill:#FFF">
+ <path
+ d="m 76.135411,34.409066 h 9.161042 V 29.36588 H 61.857537 v 5.043186 h 9.161137 v 25.92317 h 5.116737 z"
+ id="path2346" />
+ <path
+ d="m 92.647571,52.856334 h 13.659009 l 2.93009,7.476072 h 5.36461 L 101.89122,29.144903 H 97.187186 L 84.477089,60.332406 h 5.199533 z m 11.802109,-4.822276 h -9.944771 l 4.951718,-12.386462 z"
+ id="path2362" />
+ <path
+ d="m 123.80641,29.366084 h -4.58038 v 30.966322 h 20.54728 v -4.910253 c -5.32227,0 -10.64463,0 -15.9669,0 z"
+ id="path2356" />
+ <path
+ d="m 166.4722,29.366084 h -21.37564 v 30.966322 h 21.58203 v -4.910253 h -16.54771 v -8.27275 h 14.48439 V 42.23925 h -14.48439 v -7.962811 h 16.34132 z"
+ id="path2360" />
+ <path
+ d="m 191.19035,39.474593 c 0,1.59947 -0.53646,2.87535 -1.61628,3.818883 -1.07281,0.95124 -2.52409,1.422837 -4.34678,1.422837 h -7.44851 V 34.276439 h 7.4073 c 1.9051,0 3.38376,0.435027 4.42939,1.312178 1.05226,0.870258 1.57488,2.167734 1.57488,3.885976 z m 6.06602,20.857813 -7.79911,-11.723191 c 1.01771,-0.294794 1.94631,-0.714813 2.78553,-1.260566 0.83885,-0.545619 1.56122,-1.209263 2.16629,-1.990627 0.60541,-0.781738 1.07981,-1.681096 1.42369,-2.698345 0.34378,-1.017553 0.51561,-2.175238 0.51561,-3.472883 0,-1.50409 -0.24743,-2.867948 -0.74267,-4.092048 -0.49515,-1.223794 -1.20344,-2.256186 -2.12499,-3.096734 -0.92173,-0.840446 -2.04957,-1.489252 -3.38375,-1.946452 -1.33447,-0.457267 -2.82692,-0.685476 -4.4774,-0.685476 h -12.87512 v 30.966322 h 5.03433 V 49.538522 h 6.37569 l 7.11829,10.793884 z"
+ id="path2358" />
+ </g>
+ </g>
+</svg>
diff --git a/talerbank/app/templates/404.html b/talerbank/app/templates/404.html
index be89ff6..cdbd97f 100644
--- a/talerbank/app/templates/404.html
+++ b/talerbank/app/templates/404.html
@@ -1,28 +1,9 @@
-<!DOCTYPE html>
-<!--
- This file is part of GNU TALER.
- Copyright (C) 2014, 2015, 2016 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Lesser General Public License as published by the Free Software
- Foundation; either version 2.1, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-
- @author Marcello Stanisci
- @author Florian Dold
--->
{% extends "base.html" %}
-{% block headermsg %}
+{% block main %}
+
<h1>{{ _("Error") }}</h1>
-{% endblock headermsg %}
-{% block content %}
+
<aside class="sidebar" id="left">
</aside>
<section id="main">
@@ -30,4 +11,4 @@
<p>{{ _("Page not found!") }}</p>
</article>
</section>
-{% endblock content %}
+{% endblock main %}
diff --git a/talerbank/app/templates/base.html b/talerbank/app/templates/base.html
index e265866..bb9721c 100644
--- a/talerbank/app/templates/base.html
+++ b/talerbank/app/templates/base.html
@@ -1,128 +1,9 @@
-<!doctype html>
-<!--
- This file is part of GNU TALER.
- Copyright (C) 2014, 2015, 2016, 2020 Taler Systems SA
+{% extends "common_base.html" %}
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Lesser General Public License as published by the Free Software
- Foundation; either version 2.1, or (at your option) any later version.
+{% block header_content %}
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+<p>
+ {{ _("This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some <a href=\"{public_accounts}\">Public Accounts</a>.").format(public_accounts=url('public-accounts')) }}
+</p>
- You should have received a copy of the GNU Lesser General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-
- @author Marcello Stanisci
- @author Florian Dold
--->
-
-<html data-taler-nojs="true">
- <head>
- <title>{{ _("{currency} Bank - Taler Demo").format(currency=settings_value("TALER_CURRENCY")) }}</title>
- <link rel="stylesheet" type="text/css" href="{{ static('web-common/pure.css') }}" />
- <link rel="stylesheet" type="text/css" href="{{ static('web-common/demo.css') }}" />
- <link rel="stylesheet" type="text/css" href="{{ static('web-common/navbar.css') }}" />
- <link rel="stylesheet" type="text/css" href="{{ static('bank.css') }}" />
- <style>
- .warn {
- background-color: #aa393977;
- padding: 1em;
- }
- @keyframes hoveranim {
- from {left:0;}
- to {left:1vw;}
- }
- @keyframes hoveranimrevert {
- from {left:1vw;}
- to {left:0;}
- }
- .notice {
- border-radius: 1em;
- background: #0333;
- border-left: 0.3em solid #033;
- padding-left: 1em;
- padding-top: 0.5em;
- padding-bottom: 0.5em;
- margin-top: 2em;
- margin-bottom: 2em;
- }
- .notice {
- position: relative;
- left: 0;
- animation-name: hoveranimrevert;
- animation-duration: 1s;
- }
- .notice:hover {
- left: 1vw;
- animation-name: hoveranim;
- animation-duration: 1s;
- }
- #main a:link, #main a:visited, #main a:hover, #main a:active {
- color: black;
- }
- </style>
- {% block head %} {% endblock %}
- </head>
- <body>
- <header class="demobar" style="display: flex; flex-direction: column;">
- <h1><span class="tt adorn-brackets">Taler Demo</span></h1>
- <h1><span class="it"><a href="{{ url('index') }}">Bank</a></span></h1>
- <p>
- {% autoescape off %}
- {{ _("This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some <a href=\"{public_accounts}\">Public Accounts</a>.").format(public_accounts=url('public-accounts')) }}
- {% endautoescape %}
- </p>
- </header>
- <div style="display:flex; flex-direction: column;" class="navcontainer">
- {% set lang = get_locale(request.path) %}
- <nav class="demolist">
- <a href="{{ env('TALER_ENV_URL_INTRO', '#') + lang + '/' }}">{{ _("Introduction") }}</a>
- <a href="{{ env('TALER_ENV_URL_BANK', '#') + lang + '/' }}" class="active">{{ _("Bank") }}</a>
- <a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG', '#') + lang + '/' }}">{{ _("Essay Shop") }}</a>
- <a href="{{ env('TALER_ENV_URL_MERCHANT_DONATIONS', '#') + lang + '/' }}">{{ _("Donations") }}</a>
- <a href="{{ env('TALER_ENV_URL_MERCHANT_SURVEY', '#') + lang + '/' }}">{{ _("Tipping/Survey") }}</a>
- <span class="right">
- {{ {"en": _("English [en]"), "es": _("Spanish [es]"), "de": _("German [de]"), "sv": _("Swedish [sv]"), "it": _("Italiano [it]"), "pt": _("Português")}[lang] | default("en") }}
- <div class="nav">
- <br>
- {% if lang != 'en' %}
- <a href="/en/" class="navbtn">English [en]</a><br>
- {% endif %}
- {% if lang != 'de' %}
- <a href="/de/" class="navbtn">Deutsch [de]</a><br>
- {% endif %}
- {% if lang != 'es' %}
- <a href="/es/" class="navbtn">Español [es]</a><br>
- {% endif %}
- {% if lang != 'sv' %}
- <a href="/sv/" class="navbtn">Svenska [sv]</a><br>
- {% endif %}
-
- {% if lang != 'it' %}
- <a href="/it/" class="navbtn">Italiano [it]</a><br>
- {% endif %}
- {% if lang != 'pt' %}
- <a href="/pt/" class="navbtn">Português [pt]</a><br>
- {% endif %}
- </div>
- </span>
- </nav>
- </div>
- <section id="main" class="content">
- {% block headermsg %} {% endblock %}
- {% block content %} {% endblock %}
- <hr />
- <div>
- <p>
- {% autoescape off %}
- {{ _("You can learn more about Taler on our main <a href={taler_site}>website</a>.").format(taler_site="https://taler.net/") }}
- {% endautoescape %}
- </p>
- <div style="flex-grow:1"></div>
- <p>Copyright &copy; 2014&mdash;2020 Taler Systems SA</p>
- </div>
- </section>
- </body>
-</html>
+{% endblock %} \ No newline at end of file
diff --git a/talerbank/app/templates/common_base.html b/talerbank/app/templates/common_base.html
new file mode 100644
index 0000000..a90c64c
--- /dev/null
+++ b/talerbank/app/templates/common_base.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html>
+<!--
+ This file is part of GNU TALER.
+ Copyright (C) 2014, 2015, 2016, 2020, 2021 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+-->
+
+<html>
+<head>
+ <title>{{ page_title | default(gettext("GNU Taler Demo")) }}</title>
+ <link rel="stylesheet" type="text/css" href="{{ static('pure.css') }}" />
+ <link rel="stylesheet" type="text/css" href="{{ static('demo.css') }}" />
+ <link rel="stylesheet" type="text/css" href="{{ static('navbar.css') }}" />
+ <link rel="stylesheet" type="text/css" href="{{ static('torsten.css') }}" />
+ {% block head %}
+ {% endblock %}
+</head>
+
+<body>
+ <header class="demobar" style="display: flex; flex-direction: column;">
+ <p>
+ <img src="{{ static('logo-white.svg') }}" height="100"><br/>
+ </p>
+
+ <div>
+ {% block header_content %}
+ <p>This is the header content.</p>
+ {% endblock %}
+ </div>
+ </header>
+
+
+ <div style="display:flex; flex-direction: column;" class="navcontainer">
+ <nav class="demolist">
+ <a href="{{ env('TALER_ENV_URL_INTRO', '#') + getlang() + '/' }}"
+ {% if getactive() == 'landing' %} class="active" {% endif %}
+ >{{gettext("Introduction")}}</a>
+ <a href="{{ env('TALER_ENV_URL_BANK', '#') + getlang() + '/' }}"
+ {% if getactive() == 'bank' %} class="active" {% endif %}
+ >{{gettext("Bank")}}</a>
+ <a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG', '#') + getlang() + '/' }}"
+ {% if getactive() == 'blog' %} class="active" {% endif %}
+ >{{gettext("Essay Shop")}}</a>
+ <a href="{{ env('TALER_ENV_URL_MERCHANT_DONATIONS', '#') + getlang() + '/' }}"
+ {% if getactive() == 'donations' %} class="active" {% endif %}
+ >{{gettext("Donations")}}</a>
+ <a href="{{ env('TALER_ENV_URL_MERCHANT_SURVEY', '#') + getlang() + '/' }}"
+ {% if getactive() == 'survey' %} class="active" {% endif %}
+ >{{gettext("Tipping/Survey")}}</a>
+
+ {# Language Selector #}
+ <span class="right">
+ {{ all_languages[getlang()] | default("en") }}
+ <div class="nav">
+ <br>
+ {% for lang_code, lang_display in all_languages.items() %}
+ {% if lang_code != getlang() %}
+ <a href="/{{ lang_code }}/" class="navbtn">{{ lang_display }}</a>
+ <br>
+ {% endif %}
+ {% endfor %}
+ </div>
+ </span>
+
+ </nav>
+ </div>
+
+ <section id="main" class="content">
+ {% block main %}
+ This is the main content of the page.
+ {% endblock %}
+ <hr />
+ <div>
+ <p>
+ {{
+ gettext('You can learn more about GNU Taler on our main <a href="{site}">website</a>.').format(site="https://taler.net/" + getlang() + "/")
+ }}
+ </p>
+ <div style="flex-grow:1"></div>
+ <p>Copyright &copy; 2014&mdash;2021 Taler Systems SA</p>
+ </div>
+ </section>
+</body>
+</html>
diff --git a/talerbank/app/templates/login.html b/talerbank/app/templates/login.html
index 007088e..3605555 100644
--- a/talerbank/app/templates/login.html
+++ b/talerbank/app/templates/login.html
@@ -18,11 +18,10 @@
@author Florian Dold
#}
-{% block headermsg %}
- <h1 class="nav"> {{ _("Welcome to the {currency} Bank!").format(currency=settings_value("TALER_CURRENCY")) }}</h1>
-{% endblock headermsg %}
+{% block main %}
+
+<h1 class="nav"> {{ _("Welcome to the {currency} Bank!").format(currency=settings_value("TALER_CURRENCY")) }}</h1>
-{% block content %}
<section id="main">
<article>
<div class="login-form">
@@ -69,4 +68,4 @@
</p>
</article>
</section>
-{% endblock content %}
+{% endblock main %}
diff --git a/talerbank/app/templates/payto_wiretransfer.html b/talerbank/app/templates/payto_wiretransfer.html
index cdb3c0e..b3631f3 100644
--- a/talerbank/app/templates/payto_wiretransfer.html
+++ b/talerbank/app/templates/payto_wiretransfer.html
@@ -18,12 +18,12 @@
@author Florian Dold <dold@taler.net>
#}
-{% block headermsg %}
- <div>
- <a href="{{ url('logout') }}" class="pure-button">[{{ _("Logout") }}]</a><br>
- </div>
-{% endblock headermsg %}
-{% block content %}
+{% block main %}
+
+<div>
+ <a href="{{ url('logout') }}" class="pure-button">[{{ _("Logout") }}]</a><br>
+</div>
+
<section id="main">
<article>
<div>
diff --git a/talerbank/app/templates/profile_page.html b/talerbank/app/templates/profile_page.html
index 1d81b51..fe94109 100644
--- a/talerbank/app/templates/profile_page.html
+++ b/talerbank/app/templates/profile_page.html
@@ -18,7 +18,7 @@
@author Florian Dold <dold@taler.net>
#}
-{% block headermsg %}
+{% block main %}
<div>
<h1 class="nav">
{% autoescape off %}
@@ -27,8 +27,7 @@
</h1>
<a href="{{ url('logout') }}" class="pure-button">[{{ _("Logout") }}]</a><br>
</div>
-{% endblock headermsg %}
-{% block content %}
+
<section id="menu">
<p>{{ _("Bank account balance") }}: <br/> <b>{{ amount_stringify(balance) }}</b></p>
</section>
diff --git a/talerbank/app/templates/public_accounts.html b/talerbank/app/templates/public_accounts.html
index e469896..1b69594 100644
--- a/talerbank/app/templates/public_accounts.html
+++ b/talerbank/app/templates/public_accounts.html
@@ -17,11 +17,10 @@
@author Marcello Stanisci
#}
-{% block headermsg %}
+{% block main %}
+
<h1 class="nav">{{ _("History of public accounts") }}</h1>
-{% endblock headermsg %}
-{% block content %}
<a href="{{ url('index') }}">Back</a>
<section id="main">
<article>
@@ -103,4 +102,4 @@
</div>
</article>
</section>
-{% endblock content %}
+{% endblock main %}
diff --git a/talerbank/app/templates/register.html b/talerbank/app/templates/register.html
index 4f3d8c1..9474717 100644
--- a/talerbank/app/templates/register.html
+++ b/talerbank/app/templates/register.html
@@ -1,28 +1,9 @@
-<!--
- This file is part of GNU TALER.
- Copyright (C) 2014, 2015, 2016 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Lesser General Public License as published by the Free Software
- Foundation; either version 2.1, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-
- @author Marcello Stanisci
--->
-
{% extends "base.html" %}
-{% block headermsg %}
- <h1 class="nav">{{ _("Register to the {currency} bank!").format(currency=settings_value('TALER_CURRENCY')) }}</h1>
-{% endblock headermsg %}
+{% block main %}
+
+<h1 class="nav">{{ _("Register to the {currency} bank!").format(currency=settings_value('TALER_CURRENCY')) }}</h1>
-{% block content %}
<aside class="sidebar" id="left">
</aside>
<section id="main">
@@ -55,4 +36,4 @@
</div>
</article>
</section>
-{% endblock content %}
+{% endblock main %}
diff --git a/talerbank/app/templates/withdraw_confirm.html b/talerbank/app/templates/withdraw_confirm.html
index 664e013..eb3398d 100644
--- a/talerbank/app/templates/withdraw_confirm.html
+++ b/talerbank/app/templates/withdraw_confirm.html
@@ -1,29 +1,9 @@
-<!DOCTYPE html>
-<!--
- This file is part of GNU TALER.
- Copyright (C) 2014, 2015, 2016 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Lesser General Public License as published by the Free Software
- Foundation; either version 2.1, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-
- @author Marcello Stanisci
--->
-
{% extends "base.html" %}
-{% block headermsg %}
+{% block content %}
+
<h1 class="nav">{{ _("Confirm Withdrawal") }}</h1>
-{% endblock %}
-{% block content %}
{% if not is_success %}
<p class="informational informational-fail">
{{ hint }}
diff --git a/talerbank/app/templates/withdraw_show.html b/talerbank/app/templates/withdraw_show.html
index cb46141..675099e 100644
--- a/talerbank/app/templates/withdraw_show.html
+++ b/talerbank/app/templates/withdraw_show.html
@@ -1,27 +1,5 @@
-<!--
- This file is part of GNU Taler.
- Copyright (C) 2019 GNUnet e.V.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU Lesser General Public License as published by the Free Software
- Foundation; either version 2.1, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-
- @author Florian Dold
--->
-
{% extends "base.html" %}
-{% block headermsg %}
-<h1 class="nav">{{ _("Withdraw to a Taler Wallet") }}</h1>
-{% endblock %}
-
{% block head %}
<script>
// prettier-ignore
@@ -54,19 +32,10 @@
setTimeout(check, delayMs);
</script>
-<style>
-
-</style>
{% endblock head %}
-{% block content %}
-<div class="taler-installed-hide">
- <p>
- {% autoescape off %}
- {{ _("Looks like your browser doesn't support GNU Taler payments. You can try installing a <a href=\"{wallet_link}\">wallet browser extension</a>.").format(wallet_link="https://taler.net/en/wallet.html") }}
- {% endautoescape %}
- </p>
-</div>
+{% block main %}
+<h1 class="nav">{{ _("Withdraw to a Taler Wallet") }}</h1>
<p>
{{ _("You can use this QR code to withdraw to your mobile wallet:") }}
@@ -78,4 +47,4 @@
{% endautoescape %}
</p>
-{% endblock content %}
+{% endblock main %}
diff --git a/talerbank/cli.py b/talerbank/cli.py
index c62cba5..4e7f301 100644
--- a/talerbank/cli.py
+++ b/talerbank/cli.py
@@ -40,6 +40,11 @@ LOGGER = logging.getLogger(__name__)
UWSGI_LOGFMT = "%(ltime) %(proto) %(method) %(uri) %(proto) => %(status)"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "talerbank.settings")
+# Argument to tell uWSGI to load the python plugin.
+# This hack is required, because on systems where the plugin is statically linked,
+# loading it causes an error.
+arg_load_python = "--if-not-plugin python --plugins python --endif".split(" ")
+
@click.group(help="Manager script of Taler bank.")
@click.pass_context
@@ -108,6 +113,7 @@ def handle_serve_http(port):
params = [
"uwsgi",
"uwsgi",
+ *arg_load_python,
"--static-map",
"/static=%s/talerbank/app/static" % SITE_PACKAGES,
"--die-on-term",
@@ -133,6 +139,7 @@ def handle_serve_uwsgi():
params = [
"uwsgi",
"uwsgi",
+ *arg_load_python,
"--static-map",
"/static=%s/talerbank/app/static" % SITE_PACKAGES,
"--die-on-term",
@@ -166,6 +173,8 @@ def config():
TC = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE"))
TC.dump()
-
def run():
cli()
+
+if __name__ == "__main__":
+ cli()
diff --git a/talerbank/jinja2.py b/talerbank/jinja2.py
index b26b984..a91cf3b 100644
--- a/talerbank/jinja2.py
+++ b/talerbank/jinja2.py
@@ -27,6 +27,8 @@ from django.urls import reverse, get_script_prefix
from django.conf import settings
from jinja2 import Environment
from django.utils.translation import gettext
+import markupsafe
+
##
# Check if a URL is absolute or not.
@@ -128,6 +130,7 @@ def tojson(x):
def amount_stringify(amount):
return amount.stringify(settings.TALER_DIGITS, pretty=True)
+
def get_locale(url):
parts = url.split('/', 2)
if (2 >= len(parts)):
@@ -136,20 +139,52 @@ def get_locale(url):
lang = parts[1]
return lang
+
+all_languages = {
+ "en": "English [en]",
+ "ar": "Arabic [ar]",
+ "zh_Hant": "Chinese [zh]",
+ "fr": "French [fr]",
+ "de": "German [de]",
+ "hi": "Hindi [hi]",
+ "it": "Italian [it]",
+ "ja": "Japanese [ja]",
+ "ko": "Korean [ko]",
+ "pt": "Portuguese [pt]",
+ "pt_BR": "Portuguese (Brazil) [pt_BR]",
+ "ru": "Russian [ru]",
+ "es": "Spanish [es]",
+ "sv": "Swedish [sv]",
+ "tr": "Turkish [tr]",
+}
+
+
+def context_processor(request):
+ def getlang():
+ return get_locale(request.path)
+
+ return dict(getlang=getlang)
+
+
def environment(**options):
env = Environment(**options)
- env.globals.update(
- {
- "static": static,
- "url": url,
- "settings_value": settings_value,
- "env": env_get,
- "is_valid_amount": is_valid_amount,
- "amount_stringify": amount_stringify,
- "tojson": tojson,
- "_": gettext,
- "get_locale": get_locale
-
- }
+
+ gettext_markup = lambda *args, **kwargs: markupsafe.Markup(
+ gettext(*args, **kwargs)
)
+
+ env.globals.update({
+ "static": static,
+ "url": url,
+ "settings_value": settings_value,
+ "env": env_get,
+ "is_valid_amount": is_valid_amount,
+ "amount_stringify": amount_stringify,
+ "tojson": tojson,
+ "_": gettext_markup,
+ "gettext": gettext_markup,
+ "get_locale": get_locale,
+ "getactive": lambda: "bank",
+ "all_languages": all_languages,
+ })
return env
diff --git a/talerbank/settings.py b/talerbank/settings.py
index 8331761..e9c852a 100644
--- a/talerbank/settings.py
+++ b/talerbank/settings.py
@@ -18,7 +18,9 @@ from taler.util.talerconfig import TalerConfig, ConfigurationError
LOGGER = logging.getLogger(__name__)
-LOGGER.info("DJANGO_SETTINGS_MODULE: %s" % os.environ.get("DJANGO_SETTINGS_MODULE"))
+LOGGER.info(
+ "DJANGO_SETTINGS_MODULE: %s" % os.environ.get("DJANGO_SETTINGS_MODULE")
+)
TC = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE"))
@@ -79,16 +81,18 @@ MIDDLEWARE = [
"talerbank.app.middleware.DecompressionMiddleware",
]
-TEMPLATES = [
- {
- "BACKEND": "django.template.backends.jinja2.Jinja2",
- "DIRS": [
- os.path.join(BASE_DIR, "talerbank/app/static/web-common/"),
- os.path.join(BASE_DIR, "talerbank/app/templates"),
- ],
- "OPTIONS": {"environment": "talerbank.jinja2.environment"},
- }
-]
+TEMPLATES = [{
+ "BACKEND":
+ "django.template.backends.jinja2.Jinja2",
+ "DIRS": [
+ os.path.join(BASE_DIR, "talerbank/app/static/web-common/"),
+ os.path.join(BASE_DIR, "talerbank/app/templates"),
+ ],
+ "OPTIONS": {
+ "environment": "talerbank.jinja2.environment",
+ "context_processors": ["talerbank.jinja2.context_processor"],
+ },
+}]
# Disable those, since they don't work with
# jinja2 anyways.
@@ -109,10 +113,13 @@ if not DBNAME:
LOGGER.info("dbname: %s" % DBNAME)
-CHECK_DBSTRING_FORMAT = re.search(r"[a-z]+:///[a-z]+([\?][a-z]+=[a-z/]+)?", DBNAME)
+CHECK_DBSTRING_FORMAT = re.search(
+ r"[a-z]+:///[a-z]+([\?][a-z]+=[a-z/]+)?", DBNAME
+)
if not CHECK_DBSTRING_FORMAT:
LOGGER.error(
- "Bad db string given '%s', respect the format" "'dbtype:///dbname'" % DBNAME
+ "Bad db string given '%s', respect the format"
+ "'dbtype:///dbname'" % DBNAME
)
sys.exit(2)
@@ -146,12 +153,23 @@ DATABASES["default"] = DBCONFIG
AUTH_PASSWORD_VALIDATORS = [
{
- "NAME": "django.contrib.auth.password_validation"
+ "NAME":
+ "django.contrib.auth.password_validation"
".UserAttributeSimilarityValidator"
},
- {"NAME": "django.contrib.auth.password_validation" ".MinimumLengthValidator"},
- {"NAME": "django.contrib.auth.password_validation" ".CommonPasswordValidator"},
- {"NAME": "django.contrib.auth.password_validation" ".NumericPasswordValidator"},
+ {
+ "NAME": "django.contrib.auth.password_validation"
+ ".MinimumLengthValidator"
+ },
+ {
+ "NAME": "django.contrib.auth.password_validation"
+ ".CommonPasswordValidator"
+ },
+ {
+ "NAME":
+ "django.contrib.auth.password_validation"
+ ".NumericPasswordValidator"
+ },
]
# Internationalization
@@ -184,7 +202,9 @@ except ConfigurationError as exc:
LOGGER.error(exc)
sys.exit(3)
-TALER_MAX_DEBT = TC.value_string("bank", "MAX_DEBT", default="%s:50.0" % TALER_CURRENCY)
+TALER_MAX_DEBT = TC.value_string(
+ "bank", "MAX_DEBT", default="%s:50.0" % TALER_CURRENCY
+)
TALER_MAX_DEBT_BANK = TC.value_string(
"bank", "MAX_DEBT_BANK", default="%s:0.0" % TALER_CURRENCY
)
@@ -203,7 +223,9 @@ TALER_PREDEFINED_ACCOUNTS = [
]
TALER_EXPECTS_DONATIONS = ["Tor", "GNUnet", "Taler", "FSF"]
TALER_SUGGESTED_EXCHANGE = TC.value_string("bank", "suggested_exchange")
-TALER_SUGGESTED_EXCHANGE_PAYTO = TC.value_string("bank", "suggested_exchange_payto")
+TALER_SUGGESTED_EXCHANGE_PAYTO = TC.value_string(
+ "bank", "suggested_exchange_payto"
+)
_allow_reg = TC.value_string("bank", "ALLOW_REGISTRATIONS", default="no")
@@ -212,7 +234,6 @@ if _allow_reg.lower() == "yes":
else:
ALLOW_REGISTRATIONS = False
-
_show_freeform_withdrawal = TC.value_string(
"bank", "SHOW_FREEFORM_WITHDRAWAL", default="no"
)