From 291a376f381d06be7a9c92f7f91ec8e4cf102095 Mon Sep 17 00:00:00 2001 From: Thessa Kranendonk Date: Wed, 26 Oct 2022 12:08:08 -0400 Subject: [PATCH 1/7] Added @patternfly/react-icons package --- package.json | 2 +- yarn.lock | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5fe2ce3..a165882 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@fnndsc/chrisstoreapi": "^3.0.1", "@patternfly/patternfly": "^4.59.1", "@patternfly/react-core": "^4.75.2", - "@patternfly/react-icons": "^4.7.16", + "@patternfly/react-icons": "^4.92.6", "@patternfly/react-table": "^4.27.7", "classnames": "^2.2.6", "core-js": "^2.5.7", diff --git a/yarn.lock b/yarn.lock index fe56379..c8b1372 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1499,11 +1499,16 @@ tippy.js "5.1.2" tslib "^2.0.0" -"@patternfly/react-icons@^4.32.1", "@patternfly/react-icons@^4.7.16": +"@patternfly/react-icons@^4.32.1": version "4.32.1" resolved "https://registry.yarnpkg.com/@patternfly/react-icons/-/react-icons-4.32.1.tgz#5989fa8c1563b16824f1239f56b50afa2655b6de" integrity sha512-E7Fpnvax37e2ow8Xc2GngQBM7IuOpRyphZXCIUAk/NGsqpvFX27YhIVZiOUIAuBXAI5VXQBwueW/tmhmlXP7+w== +"@patternfly/react-icons@^4.92.6": + version "4.92.6" + resolved "https://registry.yarnpkg.com/@patternfly/react-icons/-/react-icons-4.92.6.tgz#a1f2190edb49ab146c30ed07f8447af5d9401f13" + integrity sha512-UdMSDqJ7fCxi/E6vlsFHuDZ3L0+kqBZ4ujRi4mjokrsvzOR4WFdaMhC+7iRy4aPNjT0DpHVjVUUUoWwKID9VqA== + "@patternfly/react-styles@^4.31.1": version "4.31.1" resolved "https://registry.yarnpkg.com/@patternfly/react-styles/-/react-styles-4.31.1.tgz#878c44282edfc731948d952d845ff477931875aa" From cbc2ccb8f07009585cf41406604bfb29f41c3577 Mon Sep 17 00:00:00 2001 From: Thessa Kranendonk Date: Wed, 26 Oct 2022 12:08:46 -0400 Subject: [PATCH 2/7] Added the option to toggle password visibility in SignIn.jsx --- src/components/SignIn/SignIn.jsx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/SignIn/SignIn.jsx b/src/components/SignIn/SignIn.jsx index a501c78..3ddf96f 100644 --- a/src/components/SignIn/SignIn.jsx +++ b/src/components/SignIn/SignIn.jsx @@ -9,7 +9,11 @@ import { CardTitle, Card, CardBody, + TextInput, + InputGroup, } from '@patternfly/react-core'; +import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon'; +import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon'; import Button from '../Button'; import './SignIn.css'; @@ -26,12 +30,14 @@ export class SignIn extends Component { password: '', loading: false, error: null, + hidePassword: true }; this.handleChange = this.handleChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); this.showError = this.showError.bind(this); this.hideError = this.hideError.bind(this); + this.togglePassword = this.togglePassword.bind(this) } componentDidMount() { @@ -78,9 +84,14 @@ export class SignIn extends Component { hideError() { this.setState({ error: null }); } + + togglePassword() { + this.setState(prevState => ({ hidePassword: !prevState.hidePassword })) + } + render() { const { - error, username, password, loading, + error, username, password, loading, hidePassword } = this.state; return ( @@ -127,16 +138,22 @@ export class SignIn extends Component { autoComplete="username" className="signin-username-form-group" /> - + this.handleChange(val, 'password')} autoComplete="current-password" className="signin-password-form-group" /> + + + + + this.handleChange(val, 'password')} - disableControls={disableControls} - error={error} - /> - this.handleChange(val, 'passwordConfirm')} + validationState={error.controls.includes('passwordConfirm') ? 'error' : 'default'} disableControls={disableControls} error={error} - /> + > + + this.handleChange(val, 'passwordConfirm')} + validated={error.controls.includes('passwordConfirm') ? 'error' : 'default'} + /> + + + +
{loading ? ( From eb3e6f103a5d2dc0bc0107c4d9b78b4ee30e71b9 Mon Sep 17 00:00:00 2001 From: Thessa Kranendonk Date: Thu, 27 Oct 2022 13:51:15 -0400 Subject: [PATCH 7/7] Added disabling of the submit button if input fields aren't populated and bugfix for wrong error message display --- .../DeveloperSignup/DeveloperSignup.jsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/Developers/components/DeveloperSignup/DeveloperSignup.jsx b/src/components/Developers/components/DeveloperSignup/DeveloperSignup.jsx index a4aa767..9f34e2b 100644 --- a/src/components/Developers/components/DeveloperSignup/DeveloperSignup.jsx +++ b/src/components/Developers/components/DeveloperSignup/DeveloperSignup.jsx @@ -33,12 +33,22 @@ export class DeveloperSignup extends Component { email: emailVal, password: String(), passwordConfirm: String(), - hidePassword: true + hidePassword: true, + disableSubmit: true }; } handleChange(value, name) { + const {password, passwordConfirm, email, username} = this.state this.setState({ [name]: value }); + + if (password.length >= 8 && passwordConfirm && email && username) { + this.setState({disableSubmit: false}) + } + + if ((password.length < 8) || (passwordConfirm.length <= 8) || (email.length <= 1) || (username.length <= 1)) { + this.setState({disableSubmit: true}) + } } handleSubmit(event) { @@ -135,7 +145,7 @@ export class DeveloperSignup extends Component { controls: ['username'], }, }); - } else { + } else if (_.has(e, 'response.data.email')){ this.setState({ loading: false, error: { @@ -184,7 +194,8 @@ export class DeveloperSignup extends Component { email, password, passwordConfirm, - hidePassword + hidePassword, + disableSubmit } = this.state; if (toDashboard) return ; @@ -274,7 +285,8 @@ export class DeveloperSignup extends Component { {loading ? ( ) : ( - )}