fixed security issue where auth key was accidentaly on disk, fixed download info bug

pull/5/head
Felix Prahl-Kamps 2018-07-19 20:54:36 +02:00
parent c488106230
commit 93f4c5b1a9
4 changed files with 13 additions and 28 deletions

View File

@ -164,7 +164,10 @@ public class CredentialsActivity extends AppCompatActivity implements View.OnCli
} }
if (myUser != null) { if (myUser != null) {
myUser.clearForStorage();
preferenceManager.setMyUser(myUser); preferenceManager.setMyUser(myUser);
} }
if (myOrganisation != null) { if (myOrganisation != null) {
@ -243,20 +246,13 @@ public class CredentialsActivity extends AppCompatActivity implements View.OnCli
private void downloadOrgInfo() { private void downloadOrgInfo() {
if (myOrganisation != null) { if (myOrganisation != null) {
DialogInterface.OnClickListener pos = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener pos = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
downloadOrgInfo(); downloadOrgInfo();
} }
}; };
new DialogFactory(this).createOverrideDialog(pos, null).show(); new DialogFactory(this).createOverrideDialog(pos, null).show();
} else {
downloadOrgInfo();
} }
if (!validCredentials()) { if (!validCredentials()) {

View File

@ -91,7 +91,7 @@ public class MainActivity extends AppCompatActivity {
emptyPartnerListView = findViewById(R.id.empty); emptyPartnerListView = findViewById(R.id.empty);
syncedPartnerRecyclerView = findViewById(R.id.recyclerView); syncedPartnerRecyclerView = findViewById(R.id.recyclerView);
syncedPartnerAdapter = new SyncedPartnerAdapter(this, syncedPartnerList); syncedPartnerAdapter = new SyncedPartnerAdapter(syncedPartnerList);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext()); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
syncedPartnerRecyclerView.setLayoutManager(mLayoutManager); syncedPartnerRecyclerView.setLayoutManager(mLayoutManager);
syncedPartnerRecyclerView.setItemAnimator(new DefaultItemAnimator()); syncedPartnerRecyclerView.setItemAnimator(new DefaultItemAnimator());

View File

@ -36,13 +36,11 @@ public class Organisation {
private int createdBy; private int createdBy;
private int userCount; private int userCount;
public Organisation() { public Organisation() {}
}
public Organisation(JSONObject json) throws JSONException { public Organisation(JSONObject json) throws JSONException {
fromJSON(json); fromJSON(json);
} }
public void fromJSON(JSONObject org) throws JSONException { public void fromJSON(JSONObject org) throws JSONException {
id = org.optInt(ID_KEY, -1); id = org.optInt(ID_KEY, -1);
@ -65,7 +63,6 @@ public class Organisation {
public JSONObject toJSON() { public JSONObject toJSON() {
return toJSON(false); return toJSON(false);
} }
public JSONObject toJSON(boolean minimal) { public JSONObject toJSON(boolean minimal) {
JSONObject org = new JSONObject(); JSONObject org = new JSONObject();
@ -99,7 +96,6 @@ public class Organisation {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getName() { public String getName() {
return name; return name;
} }
@ -107,7 +103,6 @@ public class Organisation {
public String getDescription() { public String getDescription() {
return description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
@ -115,7 +110,6 @@ public class Organisation {
public String getSector() { public String getSector() {
return sector; return sector;
} }
public void setSector(String sector) { public void setSector(String sector) {
this.sector = sector; this.sector = sector;
} }
@ -123,7 +117,6 @@ public class Organisation {
public String getNationality() { public String getNationality() {
return nationality; return nationality;
} }
public void setNationality(String nationality) { public void setNationality(String nationality) {
this.nationality = nationality; this.nationality = nationality;
} }
@ -131,7 +124,6 @@ public class Organisation {
public int getId() { public int getId() {
return id; return id;
} }
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
} }
@ -139,7 +131,6 @@ public class Organisation {
public String getDateCreated() { public String getDateCreated() {
return dateCreated; return dateCreated;
} }
public void setDateCreated(String dateCreated) { public void setDateCreated(String dateCreated) {
this.dateCreated = dateCreated; this.dateCreated = dateCreated;
} }
@ -147,7 +138,6 @@ public class Organisation {
public String getDateModified() { public String getDateModified() {
return dateModified; return dateModified;
} }
public void setDateModified(String dateModified) { public void setDateModified(String dateModified) {
this.dateModified = dateModified; this.dateModified = dateModified;
} }
@ -155,7 +145,6 @@ public class Organisation {
public String getType() { public String getType() {
return type; return type;
} }
public void setType(String type) { public void setType(String type) {
this.type = type; this.type = type;
} }
@ -163,7 +152,6 @@ public class Organisation {
public String getContacts() { public String getContacts() {
return contacts; return contacts;
} }
public void setContacts(String contacts) { public void setContacts(String contacts) {
this.contacts = contacts; this.contacts = contacts;
} }
@ -171,7 +159,6 @@ public class Organisation {
public boolean isLocal() { public boolean isLocal() {
return local; return local;
} }
public void setLocal(boolean local) { public void setLocal(boolean local) {
this.local = local; this.local = local;
} }
@ -179,7 +166,6 @@ public class Organisation {
public String getUuid() { public String getUuid() {
return uuid; return uuid;
} }
public void setUuid(String uuid) { public void setUuid(String uuid) {
this.uuid = uuid; this.uuid = uuid;
} }
@ -187,7 +173,6 @@ public class Organisation {
public String getRestrictedToDomain() { public String getRestrictedToDomain() {
return restrictedToDomain; return restrictedToDomain;
} }
public void setRestrictedToDomain(String restrictedToDomain) { public void setRestrictedToDomain(String restrictedToDomain) {
this.restrictedToDomain = restrictedToDomain; this.restrictedToDomain = restrictedToDomain;
} }
@ -195,7 +180,6 @@ public class Organisation {
public int getCreatedBy() { public int getCreatedBy() {
return createdBy; return createdBy;
} }
public void setCreatedBy(int createdBy) { public void setCreatedBy(int createdBy) {
this.createdBy = createdBy; this.createdBy = createdBy;
} }
@ -203,7 +187,6 @@ public class Organisation {
public int getUserCount() { public int getUserCount() {
return userCount; return userCount;
} }
public void setUserCount(int userCount) { public void setUserCount(int userCount) {
this.userCount = userCount; this.userCount = userCount;
} }

View File

@ -63,8 +63,8 @@ public class User {
private String dateCreated; private String dateCreated;
private String dateModified; private String dateModified;
public User() { public User() {}
}
public User(JSONObject user) throws JSONException { public User(JSONObject user) throws JSONException {
fromJSON(user); fromJSON(user);
} }
@ -138,6 +138,12 @@ public class User {
return user; return user;
} }
public void clearForStorage() {
setAuthkey("");
setGpgKey("");
setCertifPublic("");
}
public int getId() { public int getId() {
return id; return id;