Show error in login dialog if user failed to login
authorValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Fri, 29 Jul 2016 08:35:20 +0000 (11:35 +0300)
committerValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Fri, 29 Jul 2016 09:17:44 +0000 (12:17 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/ui/StudyNewProjectPanel.java

index f9b3b14a1849736f70f37150df82b2b53a1a65bc..5ecca3f399a884fe6406508366b89f1d5ff92827 100644 (file)
@@ -334,7 +334,6 @@ public class StudyNewProjectPanel extends JPanel implements PanelWithAnchor {
     @Override
     protected void doOKAction() {
       if (!validateLoginAndPasswordFields()) return;
-      super.doJustOkAction();
 
       ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
         ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
@@ -342,6 +341,7 @@ public class StudyNewProjectPanel extends JPanel implements PanelWithAnchor {
         final StepicUser stepicUser = StudyUtils.execCancelable(() -> EduStepicConnector.login(myLoginPanel.getLogin(),
                                                                                                myLoginPanel.getPassword()));
         if (stepicUser != null) {
+          ApplicationManager.getApplication().invokeLater(() -> super.doJustOkAction());
           stepicUser.setEmail(myLoginPanel.getLogin());
           stepicUser.setPassword(myLoginPanel.getPassword());
           myGenerator.myUser = stepicUser;
@@ -354,7 +354,7 @@ public class StudyNewProjectPanel extends JPanel implements PanelWithAnchor {
           setOK();
         }
         else {
-          setError("Failed to login");
+          this.setErrorText("Failed to login");
         }
       }, myProgressTitle, true, new DefaultProjectFactoryImpl().getDefaultProject());
     }