Skip to content

Commit

Permalink
Merge pull request #861 from stokito/fix_account_creation
Browse files Browse the repository at this point in the history
spark-core: separate message when account registration is not allowed
  • Loading branch information
Plyha committed Aug 6, 2024
2 parents ec07bf3 + 6124ca4 commit 686fc4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,19 +281,23 @@ public void finished() {
* @param condition the error code.
*/
private void accountCreationFailed( StanzaError.Condition condition ) {
String message = Res.getString("message.create.account");
String message;
if (condition == StanzaError.Condition.conflict) {
message = Res.getString("message.already.exists");
usernameField.setText("");
usernameField.requestFocus();
} else if (condition == StanzaError.Condition.not_allowed || condition == StanzaError.Condition.forbidden) {
message = Res.getString("message.create.account.not.allowed");
} else {
message = Res.getString("message.create.account");
}
UIManager.put("OptionPane.okButtonText", Res.getString("ok"));
JOptionPane.showMessageDialog(this, message, Res.getString("title.create.problem"), JOptionPane.ERROR_MESSAGE);
createAccountButton.setEnabled(true);
}

/**
* Called if the account was created succesfully.
* Called if the account was created successfully.
*/
private void accountCreationSuccessful() {
registered = true;
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/i18n/spark_i18n.properties
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ message.add.to.roster = Add To roster
message.add.user = Add user to your roster?
message.alert.notify = Alert notification
message.already.exists = Account already exists, please try a different username
message.create.account.not.allowed = Account creation is not allowed on the server
message.approve.subscription = Allow {0} to add you to their roster?
message.authenticating = Authenticating
message.away.idle = Away due to idle
Expand Down

0 comments on commit 686fc4a

Please sign in to comment.