mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
confirm password modal by enter key / fix password link for logged in user
This commit is contained in:
@@ -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<Props, State> {
|
||||
@@ -57,7 +58,7 @@ class PasswordConfirmation extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { t } = this.props;
|
||||
const { t, onReturnPressed } = this.props;
|
||||
return (
|
||||
<div className="columns is-multiline">
|
||||
<div className="column is-half">
|
||||
@@ -78,6 +79,7 @@ class PasswordConfirmation extends React.Component<Props, State> {
|
||||
value={this.state ? this.state.confirmedPassword : ""}
|
||||
validationError={this.state.passwordConfirmationFailed}
|
||||
errorMessage={t("password.passwordConfirmFailed")}
|
||||
onReturnPressed={onReturnPressed}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -94,7 +94,15 @@ const UserConverter: FC<Props> = ({ user, fetchUser }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const passwordChangeField = <PasswordConfirmation passwordChanged={changePassword} />;
|
||||
const onReturnPressed = () => {
|
||||
if (password && passwordValid) {
|
||||
toInternal();
|
||||
}
|
||||
};
|
||||
|
||||
const passwordChangeField = (
|
||||
<PasswordConfirmation passwordChanged={changePassword} onReturnPressed={onReturnPressed} />
|
||||
);
|
||||
const passwordModal = (
|
||||
<Modal
|
||||
body={passwordChangeField}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class MeDtoFactory extends HalAppenderMapper {
|
||||
if (UserPermissions.changePublicKeys(user).isPermitted()) {
|
||||
linksBuilder.single(link("publicKeys", resourceLinks.user().publicKeys(user.getName())));
|
||||
}
|
||||
if (userManager.isTypeDefault(user) && UserPermissions.changePassword(user).isPermitted()) {
|
||||
if (!user.isExternal() && UserPermissions.changePassword(user).isPermitted()) {
|
||||
linksBuilder.single(link("password", resourceLinks.me().passwordChange()));
|
||||
}
|
||||
if (UserPermissions.changeApiKeys(user).isPermitted()) {
|
||||
|
||||
Reference in New Issue
Block a user