bug6151: show fewer details about locking/banning to user banned from signing up

This commit is contained in:
Axel Uhl
2025-07-11 15:25:17 +02:00
parent b24cb738cf
commit e752ad1fde
10 changed files with 44 additions and 27 deletions
@@ -127,6 +127,8 @@ public class AuthenticationManagerImpl implements AuthenticationManager {
if (caught instanceof UserManagementException) {
if (Util.hasLength(caught.getMessage()) && caught.getMessage().equals(USER_ALREADY_EXISTS)) {
view.setErrorMessage(i18n.userAlreadyExists(name));
} else if (Util.hasLength(caught.getMessage()) && caught.getMessage().equals(UserManagementException.CLIENT_CURRENTLY_LOCKED_FOR_USER_CREATION)) {
view.setErrorMessage(i18n.clientCurrentlyLockedForUserCreation());
} else {
Notification.notify(i18n.errorCreatingUser(name, caught.getMessage()==null?"":caught.getMessage()), NotificationType.ERROR);
}
@@ -224,4 +224,6 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages {
String paymentUnfinished();
String paymentFinished();
String lockedUntil();
String passwordAuthenticationCurrentlyLockedForUser();
String clientCurrentlyLockedForUserCreation();
}
@@ -230,4 +230,6 @@ takeMeToSubscriptions=Go to subscription plans
errorPollingCheckoutResults=Could not retrieve payment status.
paymentUnfinished=Waiting for payment to process.
paymentFinished=Payment successful. Plan roles have been granted.
lockedUntil=Locked until
lockedUntil=Locked until
passwordAuthenticationCurrentlyLockedForUser=Password authentication is currently locked for this user due to too many failed login attempts. Please try again later.
clientCurrentlyLockedForUserCreation=Client is currently locked for user creation after too many user creations by the same client. Please try again later.
@@ -226,4 +226,6 @@ takeMeToSubscriptions=Zur Abbonementübersicht
errorPollingCheckoutResults=Der Zahlungsstatus konnte nicht abgerufen werden.
paymentUnfinished=Warte auf Zahlungsbestätigung.
paymentFinished=Zahlung erfolgreich. Planrollen wurden verliehen.
lockedUntil=Gesperrt bis
lockedUntil=Gesperrt bis
passwordAuthenticationCurrentlyLockedForUser=Passwort-Authentifizierung ist für diesen Benutzer derzeit aufgrund zu vieler fehlgeschlagener Versuche gesperrt. Bitter später erneut versuchen.
clientCurrentlyLockedForUserCreation=Benutzererstellung für den aktuellen Client ist derzeit wegen zu vieler neuer Nutzer vom selben Client gesperrt. Bitte später erneut versuchen.
@@ -179,6 +179,8 @@ public class EditProfileEntryPoint implements EntryPoint {
Notification.notify(stringMessages.passwordDoesNotMeetRequirements(), NotificationType.ERROR);
} else if (UserManagementException.INVALID_CREDENTIALS.equals(message)) {
Notification.notify(stringMessages.invalidCredentials(), NotificationType.ERROR);
} else if (UserManagementException.PASSWORD_AUTHENTICATION_CURRENTLY_LOCKED_FOR_USER.equals(message)) {
Notification.notify(stringMessages.passwordAuthenticationCurrentlyLockedForUser(), NotificationType.ERROR);
} else {
Notification.notify(stringMessages.errorChangingPassword(caught.getMessage()), NotificationType.ERROR);
}
@@ -94,29 +94,32 @@ public class RegisterView extends Composite {
/* fullName */ null, /* company */ null, LocaleInfo.getCurrentLocale().getLocaleName(),
EntryPointLinkFactory.createEmailValidationLink(new HashMap<String, String>()),
new AsyncCallback<UserDTO>() {
@Override
public void onFailure(Throwable caught) {
final String message = caught.getMessage();
if (caught instanceof UserManagementException) {
if (Util.hasLength(message) && message.equals(USER_ALREADY_EXISTS)) {
Notification.notify(stringMessages.userAlreadyExists(usernameTextBox.getText()), NotificationType.ERROR);
} else {
Notification.notify(stringMessages.errorCreatingUser(usernameTextBox.getText(), message==null?"":message), NotificationType.ERROR);
@Override
public void onFailure(Throwable caught) {
final String message = caught.getMessage();
if (caught instanceof UserManagementException) {
if (Util.hasLength(message) && message.equals(USER_ALREADY_EXISTS)) {
Notification.notify(stringMessages.userAlreadyExists(usernameTextBox.getText()), NotificationType.ERROR);
} else if (Util.hasLength(message) && message.equals(UserManagementException.CLIENT_CURRENTLY_LOCKED_FOR_USER_CREATION)) {
Notification.notify(stringMessages.clientCurrentlyLockedForUserCreation(), NotificationType.ERROR);
} else {
Notification.notify(stringMessages.errorCreatingUser(usernameTextBox.getText(),
message == null ? "" : message), NotificationType.ERROR);
}
} else {
Notification.notify(stringMessages.errorCreatingUser(usernameTextBox.getText(), message), NotificationType.ERROR);
}
}
@Override
public void onSuccess(UserDTO result) {
if (result != null) {
Notification.notify(stringMessages.signedUpSuccessfully(result.getName()), NotificationType.SUCCESS);
closeWindow();
} else {
Notification.notify(stringMessages.unknownErrorCreatingUser(usernameTextBox.getText()), NotificationType.ERROR);
}
}
} else {
Notification.notify(stringMessages.errorCreatingUser(usernameTextBox.getText(), message), NotificationType.ERROR);
}
}
@Override
public void onSuccess(UserDTO result) {
if (result != null) {
Notification.notify(stringMessages.signedUpSuccessfully(result.getName()), NotificationType.SUCCESS);
closeWindow();
} else {
Notification.notify(stringMessages.unknownErrorCreatingUser(usernameTextBox.getText()), NotificationType.ERROR);
}
}
});
}
@@ -103,6 +103,8 @@ public class UserDetailsPresenter implements AbstractUserDetails.Presenter {
Notification.notify(i18n_sec.passwordDoesNotMeetRequirements(), NotificationType.ERROR);
} else if (UserManagementException.INVALID_CREDENTIALS.equals(message)) {
Notification.notify(i18n_sec.invalidCredentials(), NotificationType.ERROR);
} else if (UserManagementException.PASSWORD_AUTHENTICATION_CURRENTLY_LOCKED_FOR_USER.equals(message)) {
Notification.notify(i18n_sec.passwordAuthenticationCurrentlyLockedForUser(), NotificationType.ERROR);
} else {
Notification.notify(i18n_sec.errorChangingPassword(caught.getMessage()), NotificationType.ERROR);
}