diff --git a/scm-core/src/main/java/sonia/scm/user/ChangePasswordNotAllowedException.java b/scm-core/src/main/java/sonia/scm/user/ChangePasswordNotAllowedException.java index da0b1b0ba3..caa35e0b88 100644 --- a/scm-core/src/main/java/sonia/scm/user/ChangePasswordNotAllowedException.java +++ b/scm-core/src/main/java/sonia/scm/user/ChangePasswordNotAllowedException.java @@ -6,10 +6,10 @@ import sonia.scm.ExceptionWithContext; public class ChangePasswordNotAllowedException extends ExceptionWithContext { private static final String CODE = "9BR7qpDAe1"; - public static final String WRONG_USER_TYPE = "User of given type are not allowed to change password"; + public static final String WRONG_USER_TYPE = "User of type %s are not allowed to change password"; - public ChangePasswordNotAllowedException(ContextEntry.ContextBuilder context) { - super(context.build(), WRONG_USER_TYPE); + public ChangePasswordNotAllowedException(ContextEntry.ContextBuilder context, String type) { + super(context.build(), String.format(WRONG_USER_TYPE, type)); } @Override diff --git a/scm-webapp/src/main/java/sonia/scm/user/DefaultUserManager.java b/scm-webapp/src/main/java/sonia/scm/user/DefaultUserManager.java index 19d6a8343b..33762a5941 100644 --- a/scm-webapp/src/main/java/sonia/scm/user/DefaultUserManager.java +++ b/scm-webapp/src/main/java/sonia/scm/user/DefaultUserManager.java @@ -422,7 +422,7 @@ public class DefaultUserManager extends AbstractUserManager throw new NotFoundException(User.class, userId); } if (!isTypeDefault(user)) { - throw new ChangePasswordNotAllowedException(ContextEntry.ContextBuilder.entity("passwordChange", "-").in(User.class, user.getName())); + throw new ChangePasswordNotAllowedException(ContextEntry.ContextBuilder.entity("passwordChange", "-").in(User.class, user.getName()), user.getType()); } user.setPassword(newPassword); this.modify(user);