forked from External/mage
Store usrName and password per server. Update input boxes with corresponding values when server is changed in ConnectDialog. Save prefs on successful requests in RegisterUserDialog and ResetPasswordDialog.
This commit is contained in:
parent
f5765383c7
commit
b114c17135
4 changed files with 48 additions and 10 deletions
|
|
@ -4,6 +4,7 @@ import java.util.concurrent.CancellationException;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.prefs.Preferences;
|
||||
import javax.swing.SwingWorker;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.util.Config;
|
||||
|
|
@ -30,8 +31,10 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
}
|
||||
|
||||
public void showDialog() {
|
||||
this.txtServer.setText(this.connectDialog.getServer());
|
||||
String serverAddress = this.connectDialog.getServer();
|
||||
this.txtServer.setText(serverAddress);
|
||||
this.txtPort.setText(this.connectDialog.getPort());
|
||||
this.txtEmail.setText(MageFrame.getPreferences().get(serverAddress + "/email", ""));
|
||||
this.lblStatus.setText("");
|
||||
|
||||
this.setModal(true);
|
||||
|
|
@ -336,6 +339,10 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
try {
|
||||
get(CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS);
|
||||
if (result) {
|
||||
// Save settings.
|
||||
Preferences prefs = MageFrame.getPreferences();
|
||||
prefs.put(connection.getHost() + "/email", connection.getEmail());
|
||||
|
||||
String message = "Auth token is emailed. Please check your inbox.";
|
||||
lblStatus.setText(message);
|
||||
MageFrame.getInstance().showMessage(message);
|
||||
|
|
@ -378,6 +385,11 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
if (result) {
|
||||
String message = "Password is reset successfully.";
|
||||
lblStatus.setText(message);
|
||||
|
||||
// Save settings.
|
||||
Preferences prefs = MageFrame.getPreferences();
|
||||
prefs.put(connection.getHost() + "/password", connection.getPassword());
|
||||
|
||||
MageFrame.getInstance().showMessage(message);
|
||||
hideDialog();
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue