diff --git a/platypush/backend/http/app/routes/settings.py b/platypush/backend/http/app/routes/settings.py index c6fa0c3a..7ba7c7a8 100644 --- a/platypush/backend/http/app/routes/settings.py +++ b/platypush/backend/http/app/routes/settings.py @@ -1,6 +1,6 @@ from flask import Blueprint, request, render_template -from platypush.backend.http.app import template_folder +from platypush.backend.http.app import template_folder, static_folder from platypush.backend.http.app.utils import authenticate from platypush.backend.http.utils import HttpUtils from platypush.config import Config @@ -20,7 +20,8 @@ def settings(): """ Settings page """ user_manager = UserManager() users = user_manager.get_users() - return render_template('settings/index.html', utils=HttpUtils, users=users, token=Config.get('token')) + return render_template('settings/index.html', utils=HttpUtils, users=users, + static_folder=static_folder, token=Config.get('token')) # vim:sw=4:ts=4:et: diff --git a/platypush/backend/http/static/js/settings/index.js b/platypush/backend/http/static/js/settings/index.js index 4d4d03cf..b6f906d6 100644 --- a/platypush/backend/http/static/js/settings/index.js +++ b/platypush/backend/http/static/js/settings/index.js @@ -3,6 +3,7 @@ window.vm = new Vue({ data: function() { return { config: window.config, + document: undefined, sessionToken: undefined, selectedTab: 'users', selectedUser: undefined, @@ -103,7 +104,7 @@ window.vm = new Vue({ onTokenFocus: function(event) { event.target.select(); - document.execCommand('copy'); + this.document.execCommand('copy'); event.target.setAttribute('disabled', true); createNotification({ @@ -116,7 +117,7 @@ window.vm = new Vue({ onTokenBlur: function(event) { event.target.select(); - document.execCommand('copy'); + this.document.execCommand('copy'); event.target.removeAttribute('disabled'); createNotification({ @@ -177,7 +178,8 @@ window.vm = new Vue({ }, created: function() { - let cookies = Object.fromEntries(document.cookie.split('; ').map(x => x.split('='))); + this.document = document; + let cookies = Object.fromEntries(this.document.cookie.split('; ').map(x => x.split('='))); this.sessionToken = cookies.session_token; }, });