Use branded footer in login and account setup pages

This commit is contained in:
Johannes Zellner
2020-03-06 01:43:54 -08:00
parent 11419365ca
commit 6d9fe0410d
4 changed files with 61 additions and 6 deletions

View File

@@ -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;
});