Add HTTPS warning

This commit is contained in:
Kane York 2015-06-30 21:21:14 -07:00
parent 1ea74847ae
commit 88d7fa955a
6 changed files with 26 additions and 10 deletions

View File

@ -46,8 +46,8 @@ const QueryResultComponent = Ember.Component.extend({
columnHandlers: function() { columnHandlers: function() {
const self = this; const self = this;
if (!this.get('content')) { if (!this.get('columns')) {
return; return [];
} }
if (self.get('opts.notransform')) { if (self.get('opts.notransform')) {
return this.get('columns').map(function(colName) { return this.get('columns').map(function(colName) {

View File

@ -35,6 +35,14 @@ export default Ember.ArrayController.extend({
this.set('results', null); this.set('results', null);
}, },
not_https: function() {
return !(
window.location.protocol === "https:" ||
window.location.hostname === "localhost" ||
window.location.hostname.endsWith(".local")
);
}.property(),
actions: { actions: {
dummy() {}, dummy() {},

View File

@ -1,5 +1,12 @@
<h2>Queries</h2> <h2>Queries</h2>
{{#if not_https}}
<div class="https-warning">
{{fa-icon "warning"}}
{{i18n "explorer.https_warning"}}
</div>
{{/if}}
<div class="query-list"> <div class="query-list">
{{combo-box valueAttribute="id" value=selectedQueryId nameProperty="listName" content=content castInteger="true" nameChanges="true"}} {{combo-box valueAttribute="id" value=selectedQueryId nameProperty="listName" content=content castInteger="true" nameChanges="true"}}
{{d-button action="showCreate" icon="plus" class="no-text"}} {{d-button action="showCreate" icon="plus" class="no-text"}}
@ -19,8 +26,6 @@
{{partial "admin/plugins-explorer-show" model=selectedItem}} {{partial "admin/plugins-explorer-show" model=selectedItem}}
</div> </div>
{{conditional-loading-spinner condition=loading}}
<div class="query-run"> <div class="query-run">
{{#if selectedItem.param_names}} {{#if selectedItem.param_names}}
<div class="query-params"> <div class="query-params">
@ -44,6 +49,8 @@
<hr> <hr>
{{conditional-loading-spinner condition=loading}}
{{#if results}} {{#if results}}
<div class="query-results"> <div class="query-results">
{{#if showResults}} {{#if showResults}}

View File

@ -1,4 +1,6 @@
.https-warning {
color: $danger;
}
.query-list { .query-list {
margin: 10px 0; margin: 10px 0;
} }
@ -47,6 +49,6 @@
} }
} }
.query-list, .query-edit, .query-results, .query-params { .query-list, .query-edit, .query-results, .query-params, .https-warning {
margin: 10px 0; margin: 10px 0;
} }

View File

@ -40,3 +40,4 @@ en:
explain_label: "Include query plan?" explain_label: "Include query plan?"
save_params: "Set Defaults" save_params: "Set Defaults"
reset_params: "Reset" reset_params: "Reset"
https_warning: "Use of the Data Explorer on sites not protected by HTTPS is discouraged. Please be careful to not retrieve sensitive information over insecure links."

View File

@ -80,11 +80,9 @@ after_initialize do
query_args = (query.qopts[:defaults] || {}).with_indifferent_access.merge(params) query_args = (query.qopts[:defaults] || {}).with_indifferent_access.merge(params)
# Rudimentary types # Rudimentary types
query_args.map! do |arg| query_args.each do |k, arg|
if arg =~ /\A\d+\z/ if arg =~ /\A\d+\z/
arg.to_i query_args[k] = arg.to_i
else
arg
end end
end end