Merge remote-tracking branch 'spiral-project/master'

This commit is contained in:
Nicolas Vanvyve 2019-12-22 17:27:45 +01:00
commit 0ed3cd8e5b
10 changed files with 603 additions and 32 deletions

View file

@ -5,6 +5,10 @@ I hate money
:target: https://travis-ci.org/spiral-project/ihatemoney
:alt: Travis CI Build Status
.. image:: https://img.shields.io/badge/maintainers-wanted-red.svg
:target: https://github.com/pickhardt/maintainers-wanted
:alt: Maintainers Wanted
*I hate money* is a web application made to ease shared budget management.
It keeps track of who bought what, when, and for whom; and helps to settle the
bills.

View file

@ -186,8 +186,20 @@ class BillHandler(Resource):
return "OK", 200
class TokenHandler(Resource):
method_decorators = [need_auth]
def get(self, project):
if not project:
return "Not Found", 404
token = project.generate_token()
return {"token": token}, 200
restful_api.add_resource(ProjectsHandler, "/projects")
restful_api.add_resource(ProjectHandler, "/projects/<string:project_id>")
restful_api.add_resource(TokenHandler, "/projects/<string:project_id>/token")
restful_api.add_resource(MembersHandler, "/projects/<string:project_id>/members")
restful_api.add_resource(
ProjectStatsHandler, "/projects/<string:project_id>/statistics"

View file

@ -133,7 +133,7 @@
<label class="sr-only" for="name">_("Add participant")</label>
{{ form.name(placeholder=_("Add participant"), class="form-control") }}
<div class="input-group-append">
<button class="btn btn-outline-secondary input-group-addon" type="submit">{{ _("Add") }}</button>
<button class="btn btn-secondary input-group-addon" type="submit">{{ _("Add") }}</button>
</div>
</div>
{% endmacro %}

View file

@ -78,7 +78,7 @@
{% block content %}
<span id="new-bill" class="float-right" {% if not g.project.members %} data-toggle="tooltip" title="{{_('You should start by adding participants')}}" {% endif %}>
<a href="{{ url_for('.add_bill') }}" class="btn btn-primary float-right {% if not g.project.members %} disabled {% endif %}" data-toggle="modal" data-target="#bill-form">
<a href="{{ url_for('.add_bill') }}" class="btn btn-primary float-right {% if not g.project.members %} disabled {% endif %}" data-toggle="modal" data-keyboard="false" data-target="#bill-form">
<i class="icon icon-white plus">{{ static_include("images/plus.svg") | safe }}</i>
{{ _("Add a new bill") }}
</a>

View file

@ -1357,6 +1357,42 @@ class APITestCase(IhatemoneyTestCase):
)
self.assertEqual(401, resp.status_code)
def test_token_creation(self):
"""Test that token of project is generated
"""
# Create project
resp = self.api_create("raclette")
self.assertTrue(201, resp.status_code)
# Get token
resp = self.client.get(
"/api/projects/raclette/token", headers=self.get_auth("raclette")
)
self.assertEqual(200, resp.status_code)
decoded_resp = json.loads(resp.data.decode("utf-8"))
# Access with token
resp = self.client.get(
"/api/projects/raclette/token",
headers={"Authorization": "Basic %s" % decoded_resp["token"]},
)
self.assertEqual(200, resp.status_code)
def test_token_login(self):
resp = self.api_create("raclette")
# Get token
resp = self.client.get(
"/api/projects/raclette/token", headers=self.get_auth("raclette")
)
decoded_resp = json.loads(resp.data.decode("utf-8"))
resp = self.client.get("/authenticate?token={}".format(decoded_resp["token"]))
# Test that we are redirected.
self.assertEqual(302, resp.status_code)
def test_member(self):
# create a project
self.api_create("raclette")

View file

@ -0,0 +1,516 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-24 18:27+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 2.4.0\n"
msgid ""
"Not a valid amount or expression. Only numbers and + - * / operators are "
"accepted."
msgstr ""
msgid "Project name"
msgstr ""
msgid "Private code"
msgstr ""
msgid "Email"
msgstr ""
msgid "Project identifier"
msgstr ""
msgid "Create the project"
msgstr ""
#, python-format
msgid ""
"A project with this identifier (\"%(project)s\") already exists. Please "
"choose a new identifier"
msgstr ""
msgid "Get in"
msgstr ""
msgid "Admin password"
msgstr ""
msgid "Send me the code by email"
msgstr ""
msgid "This project does not exists"
msgstr ""
msgid "Password mismatch"
msgstr ""
msgid "Password"
msgstr ""
msgid "Password confirmation"
msgstr ""
msgid "Reset password"
msgstr ""
msgid "Date"
msgstr ""
msgid "What?"
msgstr ""
msgid "Payer"
msgstr ""
msgid "Amount paid"
msgstr ""
msgid "External link"
msgstr ""
msgid "A link to an external document, related to this bill"
msgstr ""
msgid "For whom?"
msgstr ""
msgid "Submit"
msgstr ""
msgid "Submit and add a new one"
msgstr ""
msgid "Bills can't be null"
msgstr ""
msgid "Name"
msgstr ""
msgid "Weights should be positive"
msgstr ""
msgid "Weight"
msgstr ""
msgid "Add"
msgstr ""
msgid "User name incorrect"
msgstr ""
msgid "This project already have this member"
msgstr ""
msgid "People to notify"
msgstr ""
msgid "Send invites"
msgstr ""
#, python-format
msgid "The email %(email)s is not valid"
msgstr ""
msgid "Too many failed login attempts, please retry later."
msgstr ""
#, python-format
msgid "This admin password is not the right one. Only %(num)d attempts left."
msgstr ""
msgid "You either provided a bad token or no project identifier."
msgstr ""
msgid "This private code is not the right one"
msgstr ""
#, python-format
msgid "You have just created '%(project)s' to share your expenses"
msgstr ""
#, python-format
msgid "%(msg_compl)sThe project identifier is %(project)s"
msgstr ""
msgid "No token provided"
msgstr ""
msgid "Invalid token"
msgstr ""
msgid "Unknown project"
msgstr ""
msgid "Password successfully reset."
msgstr ""
msgid "Project successfully deleted"
msgstr ""
#, python-format
msgid "You have been invited to share your expenses for %(project)s"
msgstr ""
msgid "Your invitations have been sent"
msgstr ""
#, python-format
msgid "%(member)s had been added"
msgstr ""
#, python-format
msgid "%(name)s is part of this project again"
msgstr ""
#, python-format
msgid ""
"User '%(name)s' has been deactivated. It will still appear in the users "
"list until its balance becomes zero."
msgstr ""
#, python-format
msgid "User '%(name)s' has been removed"
msgstr ""
#, python-format
msgid "User '%(name)s' has been edited"
msgstr ""
msgid "The bill has been added"
msgstr ""
msgid "The bill has been deleted"
msgstr ""
msgid "The bill has been modified"
msgstr ""
msgid "Sorry, we were unable to find the page you've asked for."
msgstr ""
msgid "The best thing to do is probably to get back to the main page."
msgstr ""
msgid "Back to the list"
msgstr ""
msgid "Administration tasks are currently disabled."
msgstr ""
msgid "The project you are trying to access do not exist, do you want to"
msgstr ""
msgid "create it"
msgstr ""
msgid "?"
msgstr ""
msgid "Create a new project"
msgstr ""
msgid "Project"
msgstr ""
msgid "Number of members"
msgstr ""
msgid "Number of bills"
msgstr ""
msgid "Newest bill"
msgstr ""
msgid "Oldest bill"
msgstr ""
msgid "Actions"
msgstr ""
msgid "edit"
msgstr ""
msgid "delete"
msgstr ""
msgid "The Dashboard is currently deactivated."
msgstr ""
msgid "you sure?"
msgstr ""
msgid "Edit project"
msgstr ""
msgid "Download project's data"
msgstr ""
msgid "Bill items"
msgstr ""
msgid "Download the list of bills with owner, amount, reason,... "
msgstr ""
msgid "Settle plans"
msgstr ""
msgid "Download the list of transactions needed to settle the current bills."
msgstr ""
msgid "Can't remember the password?"
msgstr ""
msgid "Cancel"
msgstr ""
msgid "Edit the project"
msgstr ""
msgid "Edit this bill"
msgstr ""
msgid "Add a bill"
msgstr ""
msgid "Select all"
msgstr ""
msgid "Select none"
msgstr ""
msgid "Add participant"
msgstr ""
msgid "Edit this member"
msgstr ""
msgid "john.doe@example.com, mary.moe@site.com"
msgstr ""
msgid "Send the invitations"
msgstr ""
msgid "Download"
msgstr ""
msgid "Manage your shared <br />expenses, easily"
msgstr ""
msgid "Try out the demo"
msgstr ""
msgid "You're sharing a house?"
msgstr ""
msgid "Going on holidays with friends?"
msgstr ""
msgid "Simply sharing money with others?"
msgstr ""
msgid "We can help!"
msgstr ""
msgid "Log in to an existing project"
msgstr ""
msgid "Log in"
msgstr ""
msgid "can't remember your password?"
msgstr ""
msgid "Create"
msgstr ""
msgid ""
"This access code will be sent to your friends. It is stored as-is by the "
"server, so don\\'t reuse a personal password!"
msgstr ""
msgid "Account manager"
msgstr ""
msgid "Bills"
msgstr ""
msgid "Settle"
msgstr ""
msgid "Statistics"
msgstr ""
msgid "Settings"
msgstr ""
msgid "Languages"
msgstr ""
msgid "Projects"
msgstr ""
msgid "Start a new project"
msgstr ""
msgid "Other projects :"
msgstr ""
msgid "switch to"
msgstr ""
msgid "Dashboard"
msgstr ""
msgid "Logout"
msgstr ""
msgid "Code"
msgstr ""
msgid "Mobile Application"
msgstr ""
msgid "Documentation"
msgstr ""
msgid "Administation Dashboard"
msgstr ""
msgid "\"I hate money\" is a free software"
msgstr ""
msgid "you can contribute and improve it!"
msgstr ""
msgid "deactivate"
msgstr ""
msgid "reactivate"
msgstr ""
msgid "Invite people"
msgstr ""
msgid "You should start by adding participants"
msgstr ""
msgid "Add a new bill"
msgstr ""
msgid "When?"
msgstr ""
msgid "Who paid?"
msgstr ""
msgid "For what?"
msgstr ""
msgid "How much?"
msgstr ""
#, python-format
msgid "Added on %(date)s"
msgstr ""
msgid "Everyone"
msgstr ""
#, python-format
msgid "Everyone but %(excluded)s"
msgstr ""
msgid "each"
msgstr ""
msgid "see"
msgstr ""
msgid "No bills"
msgstr ""
msgid "Nothing to list yet."
msgstr ""
msgid "You probably want to"
msgstr ""
msgid "add a bill"
msgstr ""
msgid "add participants"
msgstr ""
msgid "Password reminder"
msgstr ""
msgid ""
"A link to reset your password has been sent to you, please check your "
"emails."
msgstr ""
msgid "Return to home page"
msgstr ""
msgid "Your projects"
msgstr ""
msgid "Reset your password"
msgstr ""
msgid "Invite people to join this project"
msgstr ""
msgid "Share Identifier & code"
msgstr ""
msgid ""
"You can share the project identifier and the private code by any "
"communication means."
msgstr ""
msgid "Identifier:"
msgstr ""
msgid "Share the Link"
msgstr ""
msgid "You can directly share the following link via your prefered medium"
msgstr ""
msgid "Send via Emails"
msgstr ""
msgid ""
"Specify a (comma separated) list of email adresses you want to notify "
"about the\n"
" creation of this budget management project and we will "
"send them an email for you."
msgstr ""
msgid "Who pays?"
msgstr ""
msgid "To whom?"
msgstr ""
msgid "Who?"
msgstr ""
msgid "Paid"
msgstr ""
msgid "Spent"
msgstr ""
msgid "Balance"
msgstr ""

View file

@ -3,14 +3,16 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-12 09:58+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"PO-Revision-Date: 2019-10-20 19:09+0000\n"
"Last-Translator: nautilusx <mail.ka@mailbox.org>\n"
"Language-Team: German <https://hosted.weblate.org/projects/i-hate-money/"
"i-hate-money/de/>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 2.4.0\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.9.1-dev\n"
msgid ""
"Not a valid amount or expression. Only numbers and + - * / operators are "
@ -70,7 +72,7 @@ msgid "Date"
msgstr "Datum"
msgid "What?"
msgstr "Was"
msgstr "Was?"
msgid "Payer"
msgstr "Von"
@ -79,7 +81,7 @@ msgid "Amount paid"
msgstr "Betrag"
msgid "For whom?"
msgstr "Für"
msgstr "Für wen?"
msgid "Submit"
msgstr "Hinzufügen"
@ -173,19 +175,19 @@ msgstr "%(member)s wurden hinzugefügt"
msgid "%(name)s is part of this project again"
msgstr "%(name)s ist wieder Teil von diesem Projekt"
#, fuzzy, python-format
#, python-format
msgid ""
"User '%(name)s' has been deactivated. It will still appear in the users "
"list until its balance becomes zero."
msgstr ""
"Der Benutzer '%(name)s' wurde deaktiviert. Er wird weiterhin in der "
"Benutzerliste erscheinen solange seine Bilanz Null ist."
"Benutzerliste erscheinen, bis sein Saldo Null ist."
#, fuzzy, python-format
#, python-format
msgid "User '%(name)s' has been removed"
msgstr "Der Benutzer '%(name)s' wurde entfernt"
#, fuzzy, python-format
#, python-format
msgid "User '%(name)s' has been edited"
msgstr "Der Benutzer '%(name)s' wurde bearbeitet"
@ -262,7 +264,7 @@ msgid "Bill items"
msgstr "Rechungsposition"
msgid "Download the list of bills with owner, amount, reason,... "
msgstr "Liste herunterladen (Mit Ersteller, Betrag, Grund, ...)"
msgstr "Liste herunterladen mit Ersteller, Betrag, Grund, ... "
msgid "Settle plans"
msgstr "Bilanz"

View file

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-01 21:48+0200\n"
"POT-Creation-Date: 2019-10-20 11:52+0200\n"
"PO-Revision-Date: 2019-09-25 22:28+0000\n"
"Last-Translator: Diego Caraballo <diegocaraballo84@gmail.com>\n"
"Language: es_419\n"
@ -82,10 +82,10 @@ msgid "Amount paid"
msgstr "Cantidad pagada"
msgid "External link"
msgstr ""
msgstr "Enlace externo"
msgid "A link to an external document, related to this bill"
msgstr ""
msgstr "Un enlace a un documento externo relaccionado con esta factura"
msgid "For whom?"
msgstr "¿Para quién?"
@ -192,7 +192,7 @@ msgstr ""
#, python-format
msgid "User '%(name)s' has been removed"
msgstr "Se ha eliminado el usuario '%(name)s'"
msgstr "Se ha eliminado al usuario '%(name)s'"
#, python-format
msgid "User '%(name)s' has been edited"
@ -300,7 +300,7 @@ msgid "Select all"
msgstr "Seleccionar todo"
msgid "Select none"
msgstr "Seleccionar ninguno"
msgstr "No seleccionar a ninguno"
msgid "Add participant"
msgstr "Añadir participante"
@ -324,16 +324,16 @@ msgid "Try out the demo"
msgstr "Prueba la demo"
msgid "You're sharing a house?"
msgstr "Estás compartiendo una casa?"
msgstr "¿Estás compartiendo una casa?"
msgid "Going on holidays with friends?"
msgstr "Te vas de vacaciones con amigos?"
msgstr "¿Te vas de vacaciones con amigos?"
msgid "Simply sharing money with others?"
msgstr "Simplemente compartes dinero con otros?"
msgstr "¿Simplemente compartes dinero con otros?"
msgid "We can help!"
msgstr "Nosotros podemos ayudarte!"
msgstr "¡Nosotros podemos ayudarte!"
msgid "Log in to an existing project"
msgstr "Iniciar sesión en un proyecto existente"
@ -440,17 +440,17 @@ msgid "Added on %(date)s"
msgstr "Agregado el %(date)s"
msgid "Everyone"
msgstr ""
msgstr "Todo el mundo"
#, python-format
msgid "Everyone but %(excluded)s"
msgstr ""
msgstr "Todo el mundo menos %(excluded)s"
msgid "each"
msgstr "Cada"
msgid "see"
msgstr ""
msgstr "ver"
msgid "No bills"
msgstr "Sin facturas"
@ -537,7 +537,7 @@ msgid "Paid"
msgstr "Pagado"
msgid "Spent"
msgstr "gastado"
msgstr "Gastado"
msgid "Balance"
msgstr "Balance"

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-30 23:53+0200\n"
"PO-Revision-Date: 2019-10-02 15:56+0000\n"
"PO-Revision-Date: 2019-11-12 09:04+0000\n"
"Last-Translator: Allan Nordhøy <epost@anotheragency.no>\n"
"Language-Team: Norwegian Bokmål <https://hosted.weblate.org/projects/"
"i-hate-money/i-hate-money/nb_NO/>\n"
@ -12,7 +12,7 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.9-dev\n"
"X-Generator: Weblate 3.10-dev\n"
"Generated-By: Babel 2.7.0\n"
msgid ""
@ -83,10 +83,10 @@ msgid "Amount paid"
msgstr "Beløp betalt"
msgid "External link"
msgstr ""
msgstr "Ekstern lenke"
msgid "A link to an external document, related to this bill"
msgstr ""
msgstr "En lenke til et eksternt dokument, i relasjon til denne regningen"
msgid "For whom?"
msgstr "For hvem?"
@ -462,8 +462,9 @@ msgstr "Alle, unntagen %(excluded)s"
msgid "each"
msgstr "hver"
#, fuzzy
msgid "see"
msgstr ""
msgstr "se"
msgid "No bills"
msgstr "Ingen regninger"