diff --git a/browser/app/js/browser/ChangePasswordModal.js b/browser/app/js/browser/ChangePasswordModal.js
index 3d34e0557..ae00e44c5 100644
--- a/browser/app/js/browser/ChangePasswordModal.js
+++ b/browser/app/js/browser/ChangePasswordModal.js
@@ -24,6 +24,7 @@ import classNames from "classnames"
import { Modal, ModalBody, ModalHeader } from "react-bootstrap"
import InputGroup from "./InputGroup"
+import { ACCESS_KEY_MIN_LENGTH, SECRET_KEY_MIN_LENGTH } from "../constants"
export class ChangePasswordModal extends React.Component {
constructor(props) {
@@ -110,8 +111,8 @@ export class ChangePasswordModal extends React.Component {
return (
this.state.currentAccessKey.length > 0 &&
this.state.currentSecretKey.length > 0 &&
- this.state.newAccessKey.length > 0 &&
- this.state.newSecretKey.length > 0
+ this.state.newAccessKey.length >= ACCESS_KEY_MIN_LENGTH &&
+ this.state.newSecretKey.length >= SECRET_KEY_MIN_LENGTH
)
}
diff --git a/browser/app/js/browser/__tests__/ChangePasswordModal.test.js b/browser/app/js/browser/__tests__/ChangePasswordModal.test.js
index 6e05dd742..57c762c5c 100644
--- a/browser/app/js/browser/__tests__/ChangePasswordModal.test.js
+++ b/browser/app/js/browser/__tests__/ChangePasswordModal.test.js
@@ -33,7 +33,7 @@ jest.mock("../../web", () => ({
currentAccessKey == "minio" &&
currentSecretKey == "minio123" &&
newAccessKey == "test" &&
- newSecretKey == "test123"
+ newSecretKey == "test1234"
) {
return Promise.resolve({})
} else {
@@ -122,6 +122,24 @@ describe("ChangePasswordModal", () => {
expect(wrapper.find("#newAccesskey").exists()).toBeFalsy()
})
+ it("should disble Update button for invalid accessKey or secretKey", () => {
+ const showAlert = jest.fn()
+ const wrapper = shallow(
+
+ )
+ wrapper
+ .find("#currentAccessKey")
+ .simulate("change", { target: { value: "minio" } })
+ wrapper
+ .find("#currentSecretKey")
+ .simulate("change", { target: { value: "minio123" } })
+ wrapper.find("#newAccessKey").simulate("change", { target: { value: "t" } })
+ wrapper
+ .find("#newSecretKey")
+ .simulate("change", { target: { value: "t1" } })
+ expect(wrapper.find("#update-keys").prop("disabled")).toBeTruthy()
+ })
+
it("should update accessKey and secretKey when Update button is clicked", () => {
const showAlert = jest.fn()
const wrapper = shallow(
@@ -138,7 +156,8 @@ describe("ChangePasswordModal", () => {
.simulate("change", { target: { value: "test" } })
wrapper
.find("#newSecretKey")
- .simulate("change", { target: { value: "test123" } })
+ .simulate("change", { target: { value: "test1234" } })
+ expect(wrapper.find("#update-keys").prop("disabled")).toBeFalsy()
wrapper.find("#update-keys").simulate("click")
setImmediate(() => {
expect(showAlert).toHaveBeenCalledWith({
diff --git a/browser/app/js/constants.js b/browser/app/js/constants.js
index 99e28d6a7..657c7352c 100644
--- a/browser/app/js/constants.js
+++ b/browser/app/js/constants.js
@@ -28,3 +28,6 @@ export const NONE = "none"
export const SHARE_OBJECT_EXPIRY_DAYS = 5
export const SHARE_OBJECT_EXPIRY_HOURS = 0
export const SHARE_OBJECT_EXPIRY_MINUTES = 0
+
+export const ACCESS_KEY_MIN_LENGTH = 3
+export const SECRET_KEY_MIN_LENGTH = 8
diff --git a/browser/ui-assets.go b/browser/ui-assets.go
index 49d0f682e..4ce8aa660 100644
--- a/browser/ui-assets.go
+++ b/browser/ui-assets.go
@@ -6,7 +6,7 @@
// production/favicon-96x96.png
// production/firefox.png
// production/index.html
-// production/index_bundle-2019-05-29T06-20-13Z.js
+// production/index_bundle-2019-05-30T05-25-50Z.js
// production/loader.css
// production/logo.svg
// production/safari.png
@@ -67,7 +67,7 @@ func productionChromePng() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "production/chrome.png", size: 3726, mode: os.FileMode(420), modTime: time.Unix(1559110823, 0)}
+ info := bindataFileInfo{name: "production/chrome.png", size: 3726, mode: os.FileMode(420), modTime: time.Unix(1559193981, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -84,7 +84,7 @@ func productionFavicon16x16Png() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "production/favicon-16x16.png", size: 14906, mode: os.FileMode(420), modTime: time.Unix(1559110823, 0)}
+ info := bindataFileInfo{name: "production/favicon-16x16.png", size: 14906, mode: os.FileMode(420), modTime: time.Unix(1559193981, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -101,7 +101,7 @@ func productionFavicon32x32Png() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "production/favicon-32x32.png", size: 16066, mode: os.FileMode(420), modTime: time.Unix(1559110823, 0)}
+ info := bindataFileInfo{name: "production/favicon-32x32.png", size: 16066, mode: os.FileMode(420), modTime: time.Unix(1559193981, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -118,7 +118,7 @@ func productionFavicon96x96Png() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "production/favicon-96x96.png", size: 17029, mode: os.FileMode(420), modTime: time.Unix(1559110823, 0)}
+ info := bindataFileInfo{name: "production/favicon-96x96.png", size: 17029, mode: os.FileMode(420), modTime: time.Unix(1559193981, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -135,7 +135,7 @@ func productionFirefoxPng() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "production/firefox.png", size: 4795, mode: os.FileMode(420), modTime: time.Unix(1559110823, 0)}
+ info := bindataFileInfo{name: "production/firefox.png", size: 4795, mode: os.FileMode(420), modTime: time.Unix(1559193981, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -195,8 +195,8 @@ var _productionIndexHTML = []byte(`
-
-
+
+