Revert "Store passwords encrypted"

This reverts commit a3063c3da4.
This commit is contained in:
M66B
2019-03-11 14:19:33 +00:00
parent 285340244e
commit cb78dddb4e
10 changed files with 27 additions and 1688 deletions

View File

@@ -19,8 +19,6 @@ package eu.faircode.email;
Copyright 2018-2019 by Marcel Bokhorst (M66B)
*/
import android.os.Build;
import org.json.JSONException;
import org.json.JSONObject;
@@ -101,20 +99,6 @@ public class EntityIdentity {
return (starttls ? "smtp" : "smtps");
}
String getPassword() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
return this.password;
else
return Helper.decryptPassword(this.password);
}
void setPassword(String plain) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
this.password = plain;
else
this.password = Helper.encryptPassword(plain);
}
public JSONObject toJSON() throws JSONException {
JSONObject json = new JSONObject();
json.put("id", id);
@@ -132,7 +116,7 @@ public class EntityIdentity {
json.put("insecure", insecure);
json.put("port", port);
json.put("user", user);
json.put("password", getPassword());
json.put("password", password);
json.put("realm", realm);
json.put("use_ip", use_ip);
@@ -170,7 +154,7 @@ public class EntityIdentity {
identity.insecure = (json.has("insecure") && json.getBoolean("insecure"));
identity.port = json.getInt("port");
identity.user = json.getString("user");
identity.setPassword(json.getString("password"));
identity.password = json.getString("password");
if (json.has("realm"))
identity.realm = json.getString("realm");
if (json.has("use_ip"))
@@ -215,7 +199,7 @@ public class EntityIdentity {
this.insecure.equals(other.insecure) &&
this.port.equals(other.port) &&
this.user.equals(other.user) &&
this.getPassword().equals(other.getPassword()) &&
this.password.equals(other.password) &&
Objects.equals(this.realm, other.realm) &&
this.use_ip == other.use_ip &&
this.synchronize.equals(other.synchronize) &&