diff options
3 files changed, 60 insertions, 17 deletions
diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index 242cfca..16b7f16 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -766,7 +766,7 @@ plugin.jabberaccregwizz.AUTORESOURCE=Auto generate resource plugin.jabberaccregwizz.PRIORITY=Priority
plugin.jabberaccregwizz.XMPP_ERROR=XMPP Error
plugin.jabberaccregwizz.UNKNOWN_XMPP_ERROR=Unknown XMPP error. Verify that the server name is correct.
-plugin.jabberaccregwizz.NOT_SAME_PASSWORD=The two entered password aren't the same.
+plugin.jabberaccregwizz.NOT_SAME_PASSWORD=Your passwords did not match.
plugin.jabberaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS=Override server default options
plugin.jabberaccregwizz.ADVANCED_OPTIONS=Advanced options
plugin.jabberaccregwizz.USE_ICE=Use ICE
@@ -871,6 +871,7 @@ plugin.sipaccregwizz.XCAP_USER=User plugin.sipaccregwizz.XCAP_PASSWORD=Password
plugin.sipaccregwizz.XCAP_SERVER_URI=Server URI
plugin.sipaccregwizz.VOICEMAIL_URI=Voicemail URI
+plugin.sipaccregwizz.NOT_SAME_PASSWORD=Your passwords did not match.
# skin manager
plugin.skinmanager.SKINS=Skins
diff --git a/src/net/java/sip/communicator/plugin/ippiaccregwizz/CreateIppiAccountForm.java b/src/net/java/sip/communicator/plugin/ippiaccregwizz/CreateIppiAccountForm.java index 4664b23..9013ba6 100644 --- a/src/net/java/sip/communicator/plugin/ippiaccregwizz/CreateIppiAccountForm.java +++ b/src/net/java/sip/communicator/plugin/ippiaccregwizz/CreateIppiAccountForm.java @@ -175,6 +175,18 @@ public class CreateIppiAccountForm */ public NewAccount createAccount() { + // Check if the two passwords match. + String pass1 = new String( passField.getPassword()); + String pass2 = new String( retypePassField.getPassword()); + if (!pass1.equals(pass2)) + { + showErrorMessage( + IppiAccRegWizzActivator.getResources().getI18NString( + "plugin.sipaccregwizz.NOT_SAME_PASSWORD")); + + return null; + } + NewAccount newAccount = null; try { @@ -277,14 +289,7 @@ public class CreateIppiAccountForm } else { - String errorMessage - = jsonObject.getString("error_message"); - - errorPane.setText(errorMessage); - add(errorPane, BorderLayout.NORTH); - - SwingUtilities.getWindowAncestor( - CreateIppiAccountForm.this).pack(); + showErrorMessage(jsonObject.getString("error_message")); } } catch (JSONException e1) @@ -295,4 +300,19 @@ public class CreateIppiAccountForm return newAccount; } + + /** + * Shows the given error message. + * + * @param text the text of the error + */ + private void showErrorMessage(String text) + { + errorPane.setText(text); + + if (errorPane.getParent() == null) + add(errorPane, BorderLayout.NORTH); + + SwingUtilities.getWindowAncestor(CreateIppiAccountForm.this).pack(); + } } diff --git a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/CreateSip2SipAccountForm.java b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/CreateSip2SipAccountForm.java index ab3ae3b..91504a6 100644 --- a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/CreateSip2SipAccountForm.java +++ b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/CreateSip2SipAccountForm.java @@ -16,6 +16,8 @@ import javax.swing.text.*; import org.json.*; +import net.java.sip.communicator.plugin.ippiaccregwizz.CreateIppiAccountForm; +import net.java.sip.communicator.plugin.ippiaccregwizz.IppiAccRegWizzActivator; import net.java.sip.communicator.plugin.sipaccregwizz.*; import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.swing.*; @@ -183,6 +185,18 @@ public class CreateSip2SipAccountForm */ public NewAccount createAccount() { + // Check if the two passwords match. + String pass1 = new String( passField.getPassword()); + String pass2 = new String( retypePassField.getPassword()); + if (!pass1.equals(pass2)) + { + showErrorMessage( + IppiAccRegWizzActivator.getResources().getI18NString( + "plugin.sipaccregwizz.NOT_SAME_PASSWORD")); + + return null; + } + NewAccount newAccount = null; try { @@ -322,14 +336,7 @@ public class CreateSip2SipAccountForm } else { - String errorMessage - = jsonObject.getString("error_message"); - - errorPane.setText(errorMessage); - add(errorPane, BorderLayout.NORTH); - - SwingUtilities.getWindowAncestor( - CreateSip2SipAccountForm.this).pack(); + showErrorMessage(jsonObject.getString("error_message")); } } catch (JSONException e1) @@ -340,4 +347,19 @@ public class CreateSip2SipAccountForm return newAccount; } + + /** + * Shows the given error message. + * + * @param text the text of the error + */ + private void showErrorMessage(String text) + { + errorPane.setText(text); + + if (errorPane.getParent() == null) + add(errorPane, BorderLayout.NORTH); + + SwingUtilities.getWindowAncestor(CreateSip2SipAccountForm.this).pack(); + } } |