Fix mixed content blocked when browsing the UI on HTTPS

When not setting an endpoint protocol scheme at login, "http" was
assumed. Changing this to the same protocol as current one, to avoid
mixed blocked content.

Also prevent multiple submissions of LoginForm.
This commit is contained in:
Lucas Verney 2016-07-28 23:57:29 +02:00
parent 945b218504
commit 157382c3b8
13 changed files with 75 additions and 56 deletions

View File

@ -1,3 +1,3 @@
{ {
"presets": ["es2015", "react"] "presets": ["es2015", "react"],
} }

View File

@ -13,7 +13,7 @@ function _cleanEndpoint (endpoint) {
!endpoint.startsWith("http://") && !endpoint.startsWith("http://") &&
!endpoint.startsWith("https://")) !endpoint.startsWith("https://"))
{ {
endpoint = "http://" + endpoint; endpoint = window.location.protocol + "//" + endpoint;
} }
// Remove trailing slash and store endpoint // Remove trailing slash and store endpoint
endpoint = endpoint.replace(/\/$/, ""); endpoint = endpoint.replace(/\/$/, "");

View File

@ -26,6 +26,10 @@ class LoginFormIntl extends Component {
handleSubmit (e) { handleSubmit (e) {
e.preventDefault(); e.preventDefault();
if (this.props.isAuthenticating) {
// Don't handle submit if already logging in
return;
}
const username = this.refs.username.value.trim(); const username = this.refs.username.value.trim();
const password = this.refs.password.value.trim(); const password = this.refs.password.value.trim();
const endpoint = this.refs.endpoint.value.trim(); const endpoint = this.refs.endpoint.value.trim();

2
app/dist/1.1.js vendored

File diff suppressed because one or more lines are too long

2
app/dist/1.1.js.map vendored

File diff suppressed because one or more lines are too long

38
app/dist/3.3.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

44
app/dist/index.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
// TODO: Refactor using normalizr // TODO: Refactor using normalizr
// TODO: https://facebook.github.io/immutable-js/ ? // TODO: https://facebook.github.io/immutable-js/ ?
import "babel-polyfill";
import fetch from "isomorphic-fetch"; import fetch from "isomorphic-fetch";
import humps from "humps"; import humps from "humps";
import X2JS from "x2js"; import X2JS from "x2js";

View File

@ -1,21 +1,14 @@
#!/bin/sh
# Get against which ref to diff # Get against which ref to diff
if git rev-parse --verify HEAD >/dev/null 2>&1 if git rev-parse --verify HEAD >/dev/null 2>&1
then then
against=HEAD against=HEAD
else else
# Initial commit: diff against an empty tree object # Initial commit
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 # TODO
exit 1
fi fi
js_files="" js_files=$(git diff-index --name-only $against | grep -e ".jsx\?$" | grep -v "^app/dist")
for file in $(git diff-index --name-only $against); do
if [[ $file == "*.js" ]] || [[ $file == "*.jsx" ]]
then
js_files="$js_files $file"
fi
done
# Nothing more to do if no JS files was committed # Nothing more to do if no JS files was committed
if [ -z "$js_files" ] if [ -z "$js_files" ]
@ -23,18 +16,6 @@ then
exit 0 exit 0
fi fi
# Run webpack
if [ -e "./node_modules/webpack/bin/webpack.js" ]
then
WEBPACK="node ./node_modules/webpack/bin/webpack.js"
elif hash webpack
then
WEBPACK="webpack"
else
exit "You should install webpack."
fi
echo "Rebuilding dist JavaScript files…" echo "Rebuilding dist JavaScript files…"
NODE_ENV=production $WEBPACK NODE_ENV=production npm run build
git add app/dist git add app/dist

View File

@ -16,7 +16,6 @@
"dependencies": { "dependencies": {
"babel-polyfill": "^6.9.1", "babel-polyfill": "^6.9.1",
"babel-preset-es2015": "^6.9.0", "babel-preset-es2015": "^6.9.0",
"babel-runtime": "^6.11.6",
"bootstrap": "^3.3.6", "bootstrap": "^3.3.6",
"fuse.js": "^2.3.0", "fuse.js": "^2.3.0",
"html5shiv": "^3.7.3", "html5shiv": "^3.7.3",

View File

@ -1,7 +1,6 @@
var path = require("path"); var path = require("path");
var webpack = require("webpack"); var webpack = require("webpack");
var ReactIntlPlugin=require("react-intl-webpack-plugin");
var ExtractTextPlugin = require("extract-text-webpack-plugin"); var ExtractTextPlugin = require("extract-text-webpack-plugin");
var postcssReporter = require("postcss-reporter"); var postcssReporter = require("postcss-reporter");
var doiuse = require("doiuse"); var doiuse = require("doiuse");
@ -80,7 +79,6 @@ module.exports = {
}, },
plugins: [ plugins: [
new ReactIntlPlugin(),
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
$: "jquery", $: "jquery",
jQuery: "jquery" jQuery: "jquery"