ihatemoney/budget/templates/home.html
0livd ea8eda35a7 Public project creation and admin permissions (#210)
* Add a @requires_admin decorator

It can be used to protect specific endpoints with ADMIN_PASSWORD
(a password that is stored unencrypted in the settings)
The decorator has no effect if ADMIN_PASSWORD is an empty string (default value)

* Require admin permissions to access create project endpoint

When ADMIN_PASSWORD is not empty, project creation form on the
home page will be replaced by a link to the create project endpoint
so one is able to enter the admin password before filling the form
2017-05-18 11:48:09 +02:00

56 lines
2.4 KiB
HTML

{% extends "layout.html" %}
{% block body %}
<header id="header" class="row">
<div class="col-5 offset-md-2">
<h2>{{ _("Manage your shared <br>expenses, easily") }}</h2>
{% if is_demo_project_activated %}
<a href="{{ url_for(".demo") }}" class="tryout btn">{{ _("Try out the demo") }}</a>
{% endif %}
</div>
<div class="col-4">
<p class="additional-content">{{ _("You're sharing a house?") }}<br /> {{ _("Going on holidays with friends?") }}<br /> {{ _("Simply sharing money with others?") }} <br /><strong>{{ _("We can help!") }}</strong></p>
</div>
</header>
<main class="row home">
<div class="col-4 offset-md-2">
<form id="authentication-form" class="form-horizontal" action="{{ url_for(".authenticate") }}" method="post">
<fieldset class="form-group">
<legend>{{ _("Log to an existing project") }}...</legend>
{{ forms.authenticate(auth_form, home=True) }}
</fieldset>
<div class="controls">
<button class="btn" type="submit">{{ _("log in") }}</button>
<a class="password-reminder" href="{{ url_for(".remind_password") }}">{{ _("can't remember your password?") }}</a>
</div>
</form>
</div>
<div class="col-3 offset-md-1">
{% if is_admin_mode_enabled %}
<a href="{{ url_for(".create_project") }}">...{{ _("or create a new one") }}</a>
{% else %}
<form id="creation-form" class="form-horizontal" action="{{ url_for(".create_project") }}" method="post">
<fieldset class="form-group">
<legend>...{{ _("or create a new one") }}</legend>
{{ forms.create_project(project_form, home=True) }}
</fieldset>
<div class="controls">
<button class="btn" type="submit">{{ _("let's get started") }}</button>
</div>
</form>
{% endif %}
</main>
</div>
{% endblock %}
{% block js %}
$('#creation-form #password').tooltip({
title: '{{ _("This access code will be sent to your friends. It is stored as-is by the server, so don\\'t reuse a personal password!") }}',
trigger: 'focus',
placement: 'right'
});
{% endblock %}