diff --git a/src/js/login.js b/src/js/login.js index 305260795..18fdea09f 100644 --- a/src/js/login.js +++ b/src/js/login.js @@ -1,10 +1,29 @@ 'use strict'; -/* global angular, $ */ +/* global angular, $, showdown */ // create main application module var app = angular.module('Application', []); +app.filter('markdown2html', function () { + var converter = new showdown.Converter({ + extensions: [], + simplifiedAutoLink: true, + strikethrough: true, + tables: true + }); + + return function (text) { + console.log(text) + return converter.makeHtml(text); + }; +}); + +// disable sce for footer https://code.angularjs.org/1.5.8/docs/api/ng/service/$sce +app.config(function ($sceProvider) { + $sceProvider.enabled(false); +}); + app.controller('LoginController', ['$scope', '$http', function ($scope, $http) { // Stupid angular location provider either wants html5 location mode or not, do the query parsing on my own var search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.indexOf('=') === -1 ? [item, true] : [item.slice(0, item.indexOf('=')), item.slice(item.indexOf('=')+1)]; }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {}); @@ -14,6 +33,8 @@ app.controller('LoginController', ['$scope', '$http', function ($scope, $http) { $scope.busy = false; $scope.error = false; $scope.cloudronName = 'Cloudron'; + $scope.footer = ''; + $scope.version = ''; $scope.username = ''; $scope.password = ''; $scope.totpToken = ''; @@ -119,6 +140,8 @@ app.controller('LoginController', ['$scope', '$http', function ($scope, $http) { if (status !== 200) return; $scope.cloudronName = data.cloudronName; + $scope.footer = data.footer; + $scope.version = data.version; }).error(function () { $scope.initialized = false; }); diff --git a/src/js/setupaccount.js b/src/js/setupaccount.js index fc47373b3..6a8af5097 100644 --- a/src/js/setupaccount.js +++ b/src/js/setupaccount.js @@ -1,10 +1,28 @@ 'use strict'; -/* global angular, $ */ +/* global angular, $, showdown */ // create main application module var app = angular.module('Application', []); +app.filter('markdown2html', function () { + var converter = new showdown.Converter({ + extensions: [], + simplifiedAutoLink: true, + strikethrough: true, + tables: true + }); + + return function (text) { + return converter.makeHtml(text); + }; +}); + +// disable sce for footer https://code.angularjs.org/1.5.8/docs/api/ng/service/$sce +app.config(function ($sceProvider) { + $sceProvider.enabled(false); +}); + app.controller('SetupAccountController', ['$scope', '$http', function ($scope, $http) { // Stupid angular location provider either wants html5 location mode or not, do the query parsing on my own var search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.indexOf('=') === -1 ? [item, true] : [item.slice(0, item.indexOf('=')), item.slice(item.indexOf('=')+1)]; }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {}); @@ -16,6 +34,8 @@ app.controller('SetupAccountController', ['$scope', '$http', function ($scope, $ $scope.error = null; $scope.view = 'setup'; $scope.cloudronName = 'Cloudron'; + $scope.footer = ''; + $scope.version = ''; $scope.existingUsername = !!search.username; $scope.username = search.username || ''; @@ -77,6 +97,8 @@ app.controller('SetupAccountController', ['$scope', '$http', function ($scope, $ if (status !== 200) return; $scope.cloudronName = data.cloudronName; + $scope.footer = data.footer; + $scope.version = data.version; }).error(function () { $scope.initialized = false; }); diff --git a/src/login.html b/src/login.html index 9f43e539e..14a77600f 100644 --- a/src/login.html +++ b/src/login.html @@ -21,6 +21,10 @@ + + + + @@ -175,8 +179,9 @@ -