From 0c8fe5a60ce38c3cbcc3ecc4f940cc1df42ee264 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Fri, 30 Oct 2020 11:48:05 +0100 Subject: [PATCH] confirm password modal by enter key / fix password link for logged in user --- .../ui-components/src/forms/PasswordConfirmation.tsx | 4 +++- .../ui-webapp/src/users/components/UserConverter.tsx | 10 +++++++++- .../java/sonia/scm/api/v2/resources/MeDtoFactory.java | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scm-ui/ui-components/src/forms/PasswordConfirmation.tsx b/scm-ui/ui-components/src/forms/PasswordConfirmation.tsx index 2db9a773fc..8d4468be4f 100644 --- a/scm-ui/ui-components/src/forms/PasswordConfirmation.tsx +++ b/scm-ui/ui-components/src/forms/PasswordConfirmation.tsx @@ -34,6 +34,7 @@ type State = { type Props = WithTranslation & { passwordChanged: (p1: string, p2: boolean) => void; passwordValidator?: (p: string) => boolean; + onReturnPressed?: () => void; }; class PasswordConfirmation extends React.Component { @@ -57,7 +58,7 @@ class PasswordConfirmation extends React.Component { } render() { - const { t } = this.props; + const { t, onReturnPressed } = this.props; return (
@@ -78,6 +79,7 @@ class PasswordConfirmation extends React.Component { value={this.state ? this.state.confirmedPassword : ""} validationError={this.state.passwordConfirmationFailed} errorMessage={t("password.passwordConfirmFailed")} + onReturnPressed={onReturnPressed} />
diff --git a/scm-ui/ui-webapp/src/users/components/UserConverter.tsx b/scm-ui/ui-webapp/src/users/components/UserConverter.tsx index cdcd24ffcf..4b2f0f0fa7 100644 --- a/scm-ui/ui-webapp/src/users/components/UserConverter.tsx +++ b/scm-ui/ui-webapp/src/users/components/UserConverter.tsx @@ -94,7 +94,15 @@ const UserConverter: FC = ({ user, fetchUser }) => { } }; - const passwordChangeField = ; + const onReturnPressed = () => { + if (password && passwordValid) { + toInternal(); + } + }; + + const passwordChangeField = ( + + ); const passwordModal = (