diff --git a/docs/configuration.md b/docs/configuration.md index a6cc5d210..bf588471a 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -173,6 +173,14 @@ URL you want. - **Default value:** `""` (empty string) - **Production value:** The URL of your chosing. +## SITE_NAME + +It is possible to change the name of the site to something at your liking. + +- **Default value:** `"I Hate Money"` (empty string) +- **Production value:** The name of your choosing + + ## Configuring email sending By default, Ihatemoney sends emails using a local SMTP server, but it's diff --git a/ihatemoney/default_settings.py b/ihatemoney/default_settings.py index 48112afb2..648573785 100644 --- a/ihatemoney/default_settings.py +++ b/ihatemoney/default_settings.py @@ -3,6 +3,7 @@ SQLALCHEMY_DATABASE_URI = "sqlite:////tmp/ihatemoney.db" SQLALCHEMY_TRACK_MODIFICATIONS = False SECRET_KEY = "tralala" +SITE_NAME = "I Hate Money" MAIL_DEFAULT_SENDER = "Budget manager " SHOW_ADMIN_EMAIL = True ACTIVATE_DEMO_PROJECT = True diff --git a/ihatemoney/templates/layout.html b/ihatemoney/templates/layout.html index 38b45064b..5c04fb2ea 100644 --- a/ihatemoney/templates/layout.html +++ b/ihatemoney/templates/layout.html @@ -20,7 +20,7 @@ - {{ _("Account manager") }}{% block title %}{% endblock %} + {{ SITE_NAME }} — {{ _("Account manager") }}{% block title %}{% endblock %} diff --git a/ihatemoney/tests/budget_test.py b/ihatemoney/tests/budget_test.py index 64a07533c..a3fc813f8 100644 --- a/ihatemoney/tests/budget_test.py +++ b/ihatemoney/tests/budget_test.py @@ -238,7 +238,10 @@ def test_password_reset(self): url, data={"password": "pass", "password_confirmation": "pass"} ) resp = self.login("raclette", password="pass") - assert "Account manager - raclette" in resp.data.decode("utf-8") + assert ( + "I Hate Money — Account manager - raclette" + in resp.data.decode("utf-8") + ) # Test empty and null tokens resp = self.client.get("/reset-password") assert "No token provided" in resp.data.decode("utf-8") diff --git a/ihatemoney/tests/ihatemoney.cfg b/ihatemoney/tests/ihatemoney.cfg index 16c7534ee..cba83608c 100644 --- a/ihatemoney/tests/ihatemoney.cfg +++ b/ihatemoney/tests/ihatemoney.cfg @@ -3,6 +3,7 @@ DEBUG = False SQLALCHEMY_DATABASE_URI = 'sqlite:///budget.db' SQLACHEMY_ECHO = DEBUG +SITE_NAME = "I Hate Money" SECRET_KEY = "supersecret" diff --git a/ihatemoney/web.py b/ihatemoney/web.py index 9dfa17c64..43b04c213 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -137,6 +137,11 @@ def set_show_admin_dashboard_link(endpoint, values): g.logout_form = LogoutForm() +@main.context_processor +def add_template_variables(): + return {"SITE_NAME": current_app.config.get("SITE_NAME")} + + @main.url_value_preprocessor def pull_project(endpoint, values): """When a request contains a project_id value, transform it directly