Fix EDU-630 Missing email in settings and login dialog in case I've already logged in
authorValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Tue, 2 Aug 2016 09:16:25 +0000 (12:16 +0300)
committerValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Tue, 2 Aug 2016 09:16:25 +0000 (12:16 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/stepic/LoginDialog.java

index e483adc8df310d2c53b7e0e33a2a129df7772b46..9f0a2779f9363f37639ceecc8d777473eaba8d1e 100644 (file)
@@ -1,7 +1,10 @@
 package com.jetbrains.edu.learning.stepic;
 
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectUtil;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.util.text.StringUtil;
+import com.jetbrains.edu.learning.StudyTaskManager;
 import com.jetbrains.edu.learning.ui.LoginPanel;
 import org.jetbrains.annotations.NotNull;
 
@@ -44,6 +47,10 @@ public class LoginDialog extends DialogWrapper {
     final StepicUser user = EduStepicConnector.login(myLoginPanel.getLogin(), myLoginPanel.getPassword());
     if (user != null) {
       doJustOkAction();
+      final Project project = ProjectUtil.guessCurrentProject(myLoginPanel.getContentPanel());
+      user.setEmail(myLoginPanel.getLogin());
+      user.setPassword(myLoginPanel.getPassword());
+      StudyTaskManager.getInstance(project).setUser(user);
     }
     else {
       setErrorText("Login failed");