Fix according to review IDEA-CR-11509: stop serializing stepic user password
authorValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Thu, 16 Jun 2016 13:02:57 +0000 (16:02 +0300)
committerValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Fri, 17 Jun 2016 12:56:42 +0000 (15:56 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/StudyTaskManager.java
python/educational-core/student/src/com/jetbrains/edu/learning/stepic/StepicUser.java

index e017f69e13c0b9427721a67122432a997aa2b158..2690d4b86660a9ff196f2de8b7a4048258136316 100644 (file)
@@ -6,11 +6,10 @@ import com.intellij.openapi.components.State;
 import com.intellij.openapi.components.Storage;
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Pair;
 import com.intellij.ui.JBColor;
-import com.intellij.util.Function;
 import com.intellij.util.containers.hash.HashMap;
 import com.intellij.util.xmlb.XmlSerializer;
+import com.intellij.util.xmlb.annotations.Transient;
 import com.jetbrains.edu.learning.core.EduUtils;
 import com.jetbrains.edu.learning.courseFormat.*;
 import com.jetbrains.edu.learning.oldCourseFormat.OldCourse;
@@ -286,20 +285,22 @@ public class StudyTaskManager implements PersistentStateComponent<Element>, Dumb
     }
     return "";
   }
-
-  public String getPassword() {
+  
+  public void setLogin(String login) {
     if (myUser != null) {
-      return myUser.getPassword();
+      myUser.setEmail(login);
     }
-    return "";
   }
 
-  public void setLogin(String login) {
+  @Transient
+  public String getPassword() {
     if (myUser != null) {
-      myUser.setEmail(login);
+      return myUser.getPassword();
     }
+    return "";
   }
 
+  @Transient
   public void setPassword(String password) {
     if (myUser != null) {
       myUser.setPassword(password);
index 9c9f468debc52bdbda094a86acb421ea89cc2a78..04f43de30d37b83815e467658c261b4c1e7cf1f8 100644 (file)
@@ -4,6 +4,7 @@ import com.intellij.ide.passwordSafe.PasswordSafe;
 import com.intellij.ide.passwordSafe.PasswordSafeException;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.xmlb.annotations.Transient;
 import com.jetbrains.edu.learning.StudyTaskManager;
 
 public class StepicUser {
@@ -54,6 +55,7 @@ public class StepicUser {
     this.email = email;
   }
 
+  @Transient
   public String getPassword() {
     final String login = getEmail();
     if (StringUtil.isEmptyOrSpaces(login)) return "";
@@ -70,6 +72,7 @@ public class StepicUser {
     return StringUtil.notNullize(password);
   }
 
+  @Transient
   public void setPassword(String password) {
     try {
       PasswordSafe.getInstance().storePassword(null, StudyTaskManager.class, STEPIC_SETTINGS_PASSWORD_KEY + getEmail(), password);