mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-17 07:22:50 +00:00
Disallow importing empty secrets
Fixes #975 And display "ERROR" for any existing bad entries. This is kind of ugly, but it's better than crashing, and there are probably very few (or zero) users who have bad entries anyway.
This commit is contained in:
parent
66b7fd38d6
commit
3bc10bd4b8
14 changed files with 159 additions and 24 deletions
|
@ -41,6 +41,8 @@ import com.beemdevelopment.aegis.helpers.FabScrollHelper;
|
|||
import com.beemdevelopment.aegis.helpers.PermissionHelper;
|
||||
import com.beemdevelopment.aegis.otp.GoogleAuthInfo;
|
||||
import com.beemdevelopment.aegis.otp.GoogleAuthInfoException;
|
||||
import com.beemdevelopment.aegis.otp.OtpInfo;
|
||||
import com.beemdevelopment.aegis.otp.OtpInfoException;
|
||||
import com.beemdevelopment.aegis.ui.dialogs.Dialogs;
|
||||
import com.beemdevelopment.aegis.ui.fragments.preferences.BackupsPreferencesFragment;
|
||||
import com.beemdevelopment.aegis.ui.fragments.preferences.PreferencesFragment;
|
||||
|
@ -931,8 +933,15 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
|
||||
@SuppressLint("InlinedApi")
|
||||
private void copyEntryCode(VaultEntry entry) {
|
||||
String otp;
|
||||
try {
|
||||
otp = entry.getInfo().getOtp();
|
||||
} catch (OtpInfoException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("text/plain", entry.getInfo().getOtp());
|
||||
ClipData clip = ClipData.newPlainText("text/plain", otp);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
PersistableBundle extras = new PersistableBundle();
|
||||
extras.putBoolean(ClipDescription.EXTRA_IS_SENSITIVE, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue