mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
Add type back to exception message
This commit is contained in:
@@ -6,10 +6,10 @@ import sonia.scm.ExceptionWithContext;
|
|||||||
public class ChangePasswordNotAllowedException extends ExceptionWithContext {
|
public class ChangePasswordNotAllowedException extends ExceptionWithContext {
|
||||||
|
|
||||||
private static final String CODE = "9BR7qpDAe1";
|
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) {
|
public ChangePasswordNotAllowedException(ContextEntry.ContextBuilder context, String type) {
|
||||||
super(context.build(), WRONG_USER_TYPE);
|
super(context.build(), String.format(WRONG_USER_TYPE, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ public class DefaultUserManager extends AbstractUserManager
|
|||||||
throw new NotFoundException(User.class, userId);
|
throw new NotFoundException(User.class, userId);
|
||||||
}
|
}
|
||||||
if (!isTypeDefault(user)) {
|
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);
|
user.setPassword(newPassword);
|
||||||
this.modify(user);
|
this.modify(user);
|
||||||
|
|||||||
Reference in New Issue
Block a user