Browse Source

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.
Phyks (Lucas Verney) 5 years ago
parent
commit
157382c3b8

+ 1
- 1
.babelrc View File

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

+ 1
- 1
app/actions/auth.js View File

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

+ 4
- 0
app/components/Login.jsx View File

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

+ 1
- 1
app/dist/1.1.js
File diff suppressed because it is too large
View File


+ 1
- 1
app/dist/1.1.js.map
File diff suppressed because it is too large
View File


+ 38
- 0
app/dist/3.3.js
File diff suppressed because it is too large
View File


+ 1
- 1
app/dist/fix.ie9.js.map
File diff suppressed because it is too large
View File


+ 22
- 22
app/dist/index.js
File diff suppressed because it is too large
View File


+ 1
- 1
app/dist/index.js.map
File diff suppressed because it is too large
View File


+ 0
- 1
app/middleware/api.js View File

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

+ 5
- 24
hooks/pre-commit View File

@@ -1,21 +1,14 @@
1
-#!/bin/sh
2
-
3 1
 # Get against which ref to diff
4 2
 if git rev-parse --verify HEAD >/dev/null 2>&1
5 3
 then
6 4
 	against=HEAD
7 5
 else
8
-	# Initial commit: diff against an empty tree object
9
-	against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
6
+	# Initial commit
7
+    # TODO
8
+    exit 1
10 9
 fi
11 10
 
12
-js_files=""
13
-for file in $(git diff-index --name-only $against); do
14
-    if [[ $file == "*.js" ]] || [[ $file == "*.jsx" ]]
15
-    then
16
-        js_files="$js_files $file"
17
-    fi
18
-done
11
+js_files=$(git diff-index --name-only $against | grep -e ".jsx\?$" | grep -v "^app/dist")
19 12
 
20 13
 # Nothing more to do if no JS files was committed
21 14
 if [ -z "$js_files" ]
@@ -23,18 +16,6 @@ then
23 16
     exit 0
24 17
 fi
25 18
 
26
-
27
-# Run webpack
28
-if [ -e "./node_modules/webpack/bin/webpack.js" ]
29
-then
30
-    WEBPACK="node ./node_modules/webpack/bin/webpack.js"
31
-elif hash webpack
32
-then
33
-    WEBPACK="webpack"
34
-else
35
-    exit "You should install webpack."
36
-fi
37
-
38 19
 echo "Rebuilding dist JavaScript files…"
39
-NODE_ENV=production $WEBPACK
20
+NODE_ENV=production npm run build
40 21
 git add app/dist

+ 0
- 1
package.json View File

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

+ 0
- 2
webpack.config.base.js View File

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