mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-24 15:56:07 +00:00
Merge pull request #338 from orangenbaumblatt/master
Keep groups when importing from Authenticator Plus
This commit is contained in:
commit
d89d5eac9c
2 changed files with 21 additions and 1 deletions
|
@ -101,7 +101,14 @@ public class AuthenticatorPlusImporter extends DatabaseImporter {
|
|||
name = parts[1];
|
||||
}
|
||||
|
||||
// Authenticator Plus saves all entries to the "All Accounts" category by default
|
||||
// If an entry is in this category, we can consider it as uncategorized
|
||||
String group = entry.getGroup();
|
||||
if (group.equals("All Accounts")) {
|
||||
return new VaultEntry(info, name, entry.getIssuer());
|
||||
}
|
||||
|
||||
return new VaultEntry(info, name, entry.getIssuer(), entry.getGroup());
|
||||
} catch (EncodingException | OtpInfoException | DatabaseImporterException e) {
|
||||
throw new DatabaseImporterEntryException(e, entry.toString());
|
||||
}
|
||||
|
@ -129,6 +136,7 @@ public class AuthenticatorPlusImporter extends DatabaseImporter {
|
|||
private String _secret;
|
||||
private String _email;
|
||||
private String _issuer;
|
||||
private String _group;
|
||||
private long _counter;
|
||||
|
||||
public Entry(Cursor cursor) {
|
||||
|
@ -137,6 +145,7 @@ public class AuthenticatorPlusImporter extends DatabaseImporter {
|
|||
_secret = SqlImporterHelper.getString(cursor, "secret");
|
||||
_email = SqlImporterHelper.getString(cursor, "email", "");
|
||||
_issuer = SqlImporterHelper.getString(cursor, "issuer", "");
|
||||
_group = SqlImporterHelper.getString(cursor, "category", "");
|
||||
_counter = SqlImporterHelper.getLong(cursor, "counter");
|
||||
}
|
||||
|
||||
|
@ -156,6 +165,10 @@ public class AuthenticatorPlusImporter extends DatabaseImporter {
|
|||
return _issuer;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return _group;
|
||||
}
|
||||
|
||||
public long getCounter() {
|
||||
return _counter;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,13 @@ public class VaultEntry extends UUIDMap.Value {
|
|||
setIssuer(issuer);
|
||||
}
|
||||
|
||||
public VaultEntry(OtpInfo info, String name, String issuer, String group) {
|
||||
this(info);
|
||||
setName(name);
|
||||
setIssuer(issuer);
|
||||
setGroup(group);
|
||||
}
|
||||
|
||||
public VaultEntry(GoogleAuthInfo info) {
|
||||
this(info.getOtpInfo(), info.getAccountName(), info.getIssuer());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue