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.
Cette révision appartient à :
Lucas Verney 2016-07-28 23:57:29 +02:00
Parent 945b218504
révision 157382c3b8
13 fichiers modifiés avec 75 ajouts et 56 suppressions

Voir le fichier

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

Voir le fichier

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

Voir le fichier

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

2
app/dist/1.1.js externe

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

38
app/dist/3.3.js externe Fichier normal

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

44
app/dist/index.js externe

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

Voir le fichier

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

Voir le fichier

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

Voir le fichier

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

Voir le fichier

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