]> source.dussan.org Git - nextcloud-server.git/commitdiff
Color the trusted domain to alert the admin a bit more 1964/head
authorJoas Schilling <coding@schilljs.com>
Mon, 31 Oct 2016 11:22:21 +0000 (12:22 +0100)
committerJoas Schilling <coding@schilljs.com>
Mon, 31 Oct 2016 11:22:21 +0000 (12:22 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
core/js/oc-dialogs.js
settings/css/settings.css
settings/js/admin.js

index 5a5bdc33d5d509af328bff6416341bd53cc41bfa..fc0734e9df443c2de0d087464edb68ff23ef9d3e 100644 (file)
@@ -76,6 +76,25 @@ var OCdialogs = {
                        modal
                );
        },
+       /**
+       * displays confirmation dialog
+       * @param text content of dialog
+       * @param title dialog title
+       * @param callback which will be triggered when user presses YES or NO
+       *        (true or false would be passed to callback respectively)
+       * @param modal make the dialog modal
+       */
+       confirmHtml:function(text, title, callback, modal) {
+               return this.message(
+                       text,
+                       title,
+                       'notice',
+                       OCdialogs.YES_NO_BUTTONS,
+                       callback,
+                       modal,
+                       true
+               );
+       },
        /**
         * displays prompt dialog
         * @param text content of dialog
@@ -251,7 +270,7 @@ var OCdialogs = {
         * Displays raw dialog
         * You better use a wrapper instead ...
        */
-       message:function(content, title, dialogType, buttons, callback, modal) {
+       message:function(content, title, dialogType, buttons, callback, modal, allowHtml) {
                return $.when(this._getMessageTemplate()).then(function($tmpl) {
                        var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
                        var dialogId = '#' + dialogName;
@@ -260,7 +279,7 @@ var OCdialogs = {
                                title: title,
                                message: content,
                                type: dialogType
-                       });
+                       }, allowHtml ? {escapeFunction: ''} : {});
                        if (modal === undefined) {
                                modal = false;
                        }
index 0dadf401c041ded7fe83d931ccd27ac173e5ebf3..ffc17c20a8b445ebcee41bd231f15bcaedef9f6c 100644 (file)
@@ -651,8 +651,13 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
        width: 129px;
 }
 
-
-
+.trusted-domain-warning {
+       color: #fff;
+       padding: 5px;
+       background: #ce3702;
+       border-radius: 5px;
+       font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
+}
 
 
 /* HELP */
index f5750b2379038e62a786497373041ae6cfb4450a..7c2b507280f510eae55ffe181b64cbab4dc6c42b 100644 (file)
@@ -3,8 +3,13 @@ $(document).ready(function(){
 
        // Hack to add a trusted domain
        if (params.trustDomain) {
-               OC.dialogs.confirm(t('settings', 'Are you really sure you want add "{domain}" as trusted domain?',
-                               {domain: params.trustDomain}),
+               var potentialDomain = params.trustDomain;
+               potentialDomain = encodeURI(escapeHTML(potentialDomain));
+               potentialDomain = '<span class="trusted-domain-warning">' + potentialDomain + '</span>';
+
+               OC.dialogs.confirmHtml(t('settings', 'Are you really sure you want add {domain} as trusted domain?', {
+                               domain: potentialDomain
+                       }, undefined, {escape: false}),
                        t('settings', 'Add trusted domain'), function(answer) {
                                if(answer) {
                                        $.ajax({