mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 16:49:10 +00:00
Improved logging in
This commit is contained in:
@@ -82,6 +82,9 @@ public final class AccountManager {
|
||||
String api = (String) ((JSONObject) result.get("data")).get("api");
|
||||
account = new Account(user, pass, api);
|
||||
return true;
|
||||
}else if (result.get("error") != null){
|
||||
Core.verbose((String) result.get("error"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.parabot.core.Core;
|
||||
import org.parabot.core.forum.AccountManager;
|
||||
import org.parabot.core.ui.images.Images;
|
||||
import org.parabot.core.ui.utils.SwingUtil;
|
||||
import org.parabot.core.ui.utils.UILog;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -38,7 +39,15 @@ public class LoginUI extends JFrame {
|
||||
String password = new String(txtPassword.getPassword());
|
||||
|
||||
if (username.length() > 0 && password.length() > 0) {
|
||||
attempt(username, password);
|
||||
if (manager.login(username, password)) {
|
||||
Core.verbose("Logged in.");
|
||||
instance.dispose();
|
||||
Core.verbose("Running server selector.");
|
||||
ServerSelector.getInstance();
|
||||
} else {
|
||||
Core.verbose("Failed to log in.");
|
||||
UILog.log("Error", "Incorrect username or password. Have you tried logging into http://bdn.parabot.org/account/", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,9 +60,7 @@ public class LoginUI extends JFrame {
|
||||
ServerSelector.getInstance();
|
||||
} else {
|
||||
Core.verbose("Failed to log in.");
|
||||
JOptionPane.showMessageDialog(null,
|
||||
"Incorrect username or password. Have you tried logging into http://bdn.parabot.org/account/", "Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
UILog.log("Error", "Incorrect username or password. Have you tried logging into http://bdn.parabot.org/account/", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.parabot.core.forum.AccountManagerAccess;
|
||||
import org.parabot.core.io.ProgressListener;
|
||||
import org.parabot.core.ui.ServerSelector;
|
||||
import org.parabot.core.ui.images.Images;
|
||||
import org.parabot.core.ui.utils.UILog;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -134,6 +135,9 @@ public class VerboseLoader extends JPanel implements ProgressListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if(manager.login(userInput.getText(), passInput.getText())) {
|
||||
switchState(STATE_SERVER_SELECT);
|
||||
} else {
|
||||
Core.verbose("Failed to log in.");
|
||||
UILog.log("Error", "Incorrect username or password. Have you tried logging into http://bdn.parabot.org/account/", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user