mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15: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 & {
|
type Props = WithTranslation & {
|
||||||
passwordChanged: (p1: string, p2: boolean) => void;
|
passwordChanged: (p1: string, p2: boolean) => void;
|
||||||
passwordValidator?: (p: string) => boolean;
|
passwordValidator?: (p: string) => boolean;
|
||||||
|
onReturnPressed?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PasswordConfirmation extends React.Component<Props, State> {
|
class PasswordConfirmation extends React.Component<Props, State> {
|
||||||
@@ -57,7 +58,7 @@ class PasswordConfirmation extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { t } = this.props;
|
const { t, onReturnPressed } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className="columns is-multiline">
|
<div className="columns is-multiline">
|
||||||
<div className="column is-half">
|
<div className="column is-half">
|
||||||
@@ -78,6 +79,7 @@ class PasswordConfirmation extends React.Component<Props, State> {
|
|||||||
value={this.state ? this.state.confirmedPassword : ""}
|
value={this.state ? this.state.confirmedPassword : ""}
|
||||||
validationError={this.state.passwordConfirmationFailed}
|
validationError={this.state.passwordConfirmationFailed}
|
||||||
errorMessage={t("password.passwordConfirmFailed")}
|
errorMessage={t("password.passwordConfirmFailed")}
|
||||||
|
onReturnPressed={onReturnPressed}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</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 = (
|
const passwordModal = (
|
||||||
<Modal
|
<Modal
|
||||||
body={passwordChangeField}
|
body={passwordChangeField}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class MeDtoFactory extends HalAppenderMapper {
|
|||||||
if (UserPermissions.changePublicKeys(user).isPermitted()) {
|
if (UserPermissions.changePublicKeys(user).isPermitted()) {
|
||||||
linksBuilder.single(link("publicKeys", resourceLinks.user().publicKeys(user.getName())));
|
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()));
|
linksBuilder.single(link("password", resourceLinks.me().passwordChange()));
|
||||||
}
|
}
|
||||||
if (UserPermissions.changeApiKeys(user).isPermitted()) {
|
if (UserPermissions.changeApiKeys(user).isPermitted()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user