Skip to content

Firefly III: a personal finances manager

Fix #5276

James Cole16391fe99c88
diff --git a/public/v1/js/ff/firefly.js b/public/v1/js/ff/firefly.js
index fe919d3dc8..6715e3db06 100644
--- a/public/v1/js/ff/firefly.js
+++ b/public/v1/js/ff/firefly.js
@@ -25,6 +25,12 @@ $(function () {
configAccounting(currencySymbol);
+ // on submit of logout button:
+ $('.logout-link').click(function(e) {
+ e.preventDefault();
+ document.getElementById('logout-form').submit();
+ });
+
// on submit of form, disable any button in form:
$('form.form-horizontal:not(.nodisablebutton)').on('submit', function () {
$('button[type="submit"]').prop('disabled', true);
diff --git a/resources/views/v1/layout/default.twig b/resources/views/v1/layout/default.twig
index cf02557e28..254e6f207f 100644
--- a/resources/views/v1/layout/default.twig
+++ b/resources/views/v1/layout/default.twig
@@ -239,6 +239,9 @@
);
}
</script>
+<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
+ <input type="hidden" name="_token" value="{{ csrf_token() }}" />
+</form>
</body>
</html>
diff --git a/resources/views/v1/partials/menu-sidebar.twig b/resources/views/v1/partials/menu-sidebar.twig
index b9de1279cc..07a57665c5 100644
--- a/resources/views/v1/partials/menu-sidebar.twig
+++ b/resources/views/v1/partials/menu-sidebar.twig
@@ -224,11 +224,8 @@
{% if 'remote_user_guard' != authGuard or '' != logoutUri %}
- <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
- <input type="hidden" name="_token" value="{{ csrf_token() }}" />
- </form>
<li>
- <a href="{{ route('logout') }}" onclick="event.preventDefault();document.getElementById('logout-form').submit();">
+ <a href="{{ route('logout') }}" class="logout-link">
<span class="fa fa-sign-out fa-fw"></span>
<span>{{ 'logout'|_ }}</span>
</a>
diff --git a/resources/views/v1/profile/index.twig b/resources/views/v1/profile/index.twig
index e7077141ea..631dd0e3b5 100644
--- a/resources/views/v1/profile/index.twig
+++ b/resources/views/v1/profile/index.twig
@@ -53,11 +53,7 @@
</li>
{% endif %}
- <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
- <input type="hidden" name="_token" value="{{ csrf_token() }}" />
- </form>
-
- <li><a href="{{ route('logout') }}" onclick="event.preventDefault();document.getElementById('logout-form').submit();">{{ 'logout'|_ }}</a></li>
+ <li><a href="{{ route('logout') }}" class="logout-link">{{ 'logout'|_ }}</a></li>
{% if true == isInternalAuth and true == isInternalIdentity %}
<li>