Color the trusted domain to alert the admin a bit more

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2016-10-31 12:22:21 +01:00
parent 357a823457
commit 247b7f37ce
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
3 changed files with 35 additions and 6 deletions

View File

@ -76,6 +76,25 @@ var OCdialogs = {
modal 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 * displays prompt dialog
* @param text content of dialog * @param text content of dialog
@ -251,7 +270,7 @@ var OCdialogs = {
* Displays raw dialog * Displays raw dialog
* You better use a wrapper instead ... * 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) { return $.when(this._getMessageTemplate()).then(function($tmpl) {
var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content'; var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
var dialogId = '#' + dialogName; var dialogId = '#' + dialogName;
@ -260,7 +279,7 @@ var OCdialogs = {
title: title, title: title,
message: content, message: content,
type: dialogType type: dialogType
}); }, allowHtml ? {escapeFunction: ''} : {});
if (modal === undefined) { if (modal === undefined) {
modal = false; modal = false;
} }

View File

@ -651,8 +651,13 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
width: 129px; width: 129px;
} }
.trusted-domain-warning {
color: #fff;
padding: 5px;
background: #ce3702;
border-radius: 5px;
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}
/* HELP */ /* HELP */

View File

@ -3,8 +3,13 @@ $(document).ready(function(){
// Hack to add a trusted domain // Hack to add a trusted domain
if (params.trustDomain) { if (params.trustDomain) {
OC.dialogs.confirm(t('settings', 'Are you really sure you want add "{domain}" as trusted domain?', var potentialDomain = params.trustDomain;
{domain: 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) { t('settings', 'Add trusted domain'), function(answer) {
if(answer) { if(answer) {
$.ajax({ $.ajax({