Fixes sip2sip and ippi create account forms (fixed problems in error showing and added a password comparison).

cusax-fix
Yana Stamcheva 15 years ago
parent 5c731298ec
commit 74c93fae64

@ -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

@ -175,6 +175,18 @@ private void initErrorArea()
*/
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 @@ private NewAccount parseHttpResponse(String response)
}
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 @@ private NewAccount parseHttpResponse(String response)
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();
}
}

@ -16,6 +16,8 @@
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 @@ private void initErrorArea()
*/
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 @@ private NewAccount parseHttpResponse(String response)
}
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 @@ private NewAccount parseHttpResponse(String response)
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();
}
}

Loading…
Cancel
Save