From 97c174f82e65ad1c78e9e6099dcc4d95f3f4f840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20=C4=8Cern=C3=BD?= Date: Mon, 15 Jan 2024 13:52:45 +0100 Subject: [PATCH 1/3] Fix #1515: Enable show password --- powerauth-webflow/package-lock.json | 20 +++++++++++++ powerauth-webflow/package.json | 1 + .../src/main/js/components/smsComponent.js | 28 +++++++++++++++---- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/powerauth-webflow/package-lock.json b/powerauth-webflow/package-lock.json index 02f4f8dfb..494b0ab00 100644 --- a/powerauth-webflow/package-lock.json +++ b/powerauth-webflow/package-lock.json @@ -16,6 +16,7 @@ "lodash": "^4.17.21", "react": "^16.14.0", "react-bootstrap": "^0.33.1", + "react-bootstrap-icons": "^1.10.3", "react-device-detect": "^2.2.3", "react-dom": "^16.14.0", "react-flags-select": "^2.2.3", @@ -4013,6 +4014,17 @@ "react-dom": ">=16.3.0" } }, + "node_modules/react-bootstrap-icons": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/react-bootstrap-icons/-/react-bootstrap-icons-1.10.3.tgz", + "integrity": "sha512-j4hSby6gT9/enhl3ybB1tfr1slZNAYXDVntcRrmVjxB3//2WwqrzpESVqKhyayYVaWpEtnwf9wgUQ03cuziwrw==", + "dependencies": { + "prop-types": "^15.7.2" + }, + "peerDependencies": { + "react": ">=16.8.6" + } + }, "node_modules/react-bootstrap/node_modules/warning": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", @@ -7940,6 +7952,14 @@ } } }, + "react-bootstrap-icons": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/react-bootstrap-icons/-/react-bootstrap-icons-1.10.3.tgz", + "integrity": "sha512-j4hSby6gT9/enhl3ybB1tfr1slZNAYXDVntcRrmVjxB3//2WwqrzpESVqKhyayYVaWpEtnwf9wgUQ03cuziwrw==", + "requires": { + "prop-types": "^15.7.2" + } + }, "react-device-detect": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/react-device-detect/-/react-device-detect-2.2.3.tgz", diff --git a/powerauth-webflow/package.json b/powerauth-webflow/package.json index 0f2e28b80..28188bc83 100644 --- a/powerauth-webflow/package.json +++ b/powerauth-webflow/package.json @@ -26,6 +26,7 @@ "lodash": "^4.17.21", "react": "^16.14.0", "react-bootstrap": "^0.33.1", + "react-bootstrap-icons": "^1.10.3", "react-device-detect": "^2.2.3", "react-dom": "^16.14.0", "react-flags-select": "^2.2.3", diff --git a/powerauth-webflow/src/main/js/components/smsComponent.js b/powerauth-webflow/src/main/js/components/smsComponent.js index c4894cbd5..f838133b4 100644 --- a/powerauth-webflow/src/main/js/components/smsComponent.js +++ b/powerauth-webflow/src/main/js/components/smsComponent.js @@ -15,7 +15,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -import {Button, FormControl, FormGroup} from "react-bootstrap"; +import {Button, FormControl, FormGroup, InputGroup } from "react-bootstrap"; +import { Eye, EyeSlashFill } from "react-bootstrap-icons"; import {FormattedMessage} from "react-intl"; import React from "react"; import {authenticate, initializeICAClientSign} from "../actions/smsAuthActions"; @@ -36,6 +37,7 @@ export default class SmsComponent extends React.Component { super(); this.handleAuthCodeChange = this.handleAuthCodeChange.bind(this); this.handlePasswordChange = this.handlePasswordChange.bind(this); + this.handleToggle = this.handleToggle.bind(this); this.handleCertificateChoice = this.handleCertificateChoice.bind(this); this.handleSubmit = this.handleSubmit.bind(this); this.updateButtonState = this.updateButtonState.bind(this); @@ -48,7 +50,7 @@ export default class SmsComponent extends React.Component { this.onCertificatesLoaded = this.onCertificatesLoaded.bind(this); this.onSignerSucceeded = this.onSignerSucceeded.bind(this); this.onSignerFailed = this.onSignerFailed.bind(this); - this.state = {authCode: '', password: '', confirmDisabled: true, signerReady: false, signerInitFailed: false, signerError: null, certificates: null, chosenCertificate: null, signedMessage: null}; + this.state = {authCode: '', password: '', confirmDisabled: true, signerReady: false, signerInitFailed: false, signerError: null, certificates: null, chosenCertificate: null, signedMessage: null, pwdType:'password'}; } componentDidMount() { @@ -68,6 +70,14 @@ export default class SmsComponent extends React.Component { this.setState({password: event.target.value}, this.updateButtonState); } + handleToggle(event) { + if (this.state.pwdType=='password'){ + this.setState ({pwdType: 'text'}); + } else { + this.setState ({pwdType: 'password'}); + } + } + handleCertificateChoice(certificate) { this.setState({chosenCertificate: certificate}); } @@ -203,6 +213,7 @@ export default class SmsComponent extends React.Component { this.setState({signerError: errorMessage, signedMessage: null, certificates: null, chosenCertificate: null}); } + render() { const formatMessage = this.props.intl.formatMessage; return ( @@ -320,10 +331,15 @@ export default class SmsComponent extends React.Component {
- + + + + {(this.state.pwdType=='password') ? : } + +
From fd1414ca9673c883588ffe589965e54fe538ccc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20=C4=8Cern=C3=BD?= Date: Mon, 15 Jan 2024 14:07:07 +0100 Subject: [PATCH 2/3] Fix formatting. --- powerauth-webflow/src/main/js/components/smsComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-webflow/src/main/js/components/smsComponent.js b/powerauth-webflow/src/main/js/components/smsComponent.js index f838133b4..4036df90a 100644 --- a/powerauth-webflow/src/main/js/components/smsComponent.js +++ b/powerauth-webflow/src/main/js/components/smsComponent.js @@ -72,7 +72,7 @@ export default class SmsComponent extends React.Component { handleToggle(event) { if (this.state.pwdType=='password'){ - this.setState ({pwdType: 'text'}); + this.setState ({pwdType: 'text'}); } else { this.setState ({pwdType: 'password'}); } From 14ba8d2ba18a6593cc4622d351320b38c2c7e539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20=C4=8Cern=C3=BD?= Date: Mon, 15 Jan 2024 14:09:05 +0100 Subject: [PATCH 3/3] Remove redundant line. --- powerauth-webflow/src/main/js/components/smsComponent.js | 1 - 1 file changed, 1 deletion(-) diff --git a/powerauth-webflow/src/main/js/components/smsComponent.js b/powerauth-webflow/src/main/js/components/smsComponent.js index 4036df90a..fbf0d0e59 100644 --- a/powerauth-webflow/src/main/js/components/smsComponent.js +++ b/powerauth-webflow/src/main/js/components/smsComponent.js @@ -213,7 +213,6 @@ export default class SmsComponent extends React.Component { this.setState({signerError: errorMessage, signedMessage: null, certificates: null, chosenCertificate: null}); } - render() { const formatMessage = this.props.intl.formatMessage; return (