Fixed a few bugs.
This commit is contained in:
parent
b346b3be65
commit
6a1768a50d
@ -66,7 +66,7 @@
|
|||||||
android:onClick="onAction" />
|
android:onClick="onAction" />
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/nativeKDF"
|
android:id="@+id/nativeKDFField"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
|
@ -76,8 +76,9 @@ public class EmergencyActivity extends Activity {
|
|||||||
@InjectView(R.id.maskPasswordField)
|
@InjectView(R.id.maskPasswordField)
|
||||||
CheckBox maskPasswordField;
|
CheckBox maskPasswordField;
|
||||||
|
|
||||||
private int hc_userName;
|
private int id_userName;
|
||||||
private int hc_masterPassword;
|
private int id_masterPassword;
|
||||||
|
private int id_version;
|
||||||
private String sitePassword;
|
private String sitePassword;
|
||||||
|
|
||||||
public static void start(Context context) {
|
public static void start(Context context) {
|
||||||
@ -221,7 +222,7 @@ public class EmergencyActivity extends Activity {
|
|||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
if (preferences.isForgetPassword()) {
|
if (preferences.isForgetPassword()) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
hc_userName = hc_masterPassword = 0;
|
id_userName = id_masterPassword = 0;
|
||||||
if (masterKeyFuture != null) {
|
if (masterKeyFuture != null) {
|
||||||
masterKeyFuture.cancel( true );
|
masterKeyFuture.cancel( true );
|
||||||
masterKeyFuture = null;
|
masterKeyFuture = null;
|
||||||
@ -242,16 +243,13 @@ public class EmergencyActivity extends Activity {
|
|||||||
final String fullName = fullNameField.getText().toString();
|
final String fullName = fullNameField.getText().toString();
|
||||||
final char[] masterPassword = masterPasswordField.getText().toString().toCharArray();
|
final char[] masterPassword = masterPasswordField.getText().toString().toCharArray();
|
||||||
final MasterKey.Version version = (MasterKey.Version) siteVersionButton.getTag();
|
final MasterKey.Version version = (MasterKey.Version) siteVersionButton.getTag();
|
||||||
try {
|
if (fullName.hashCode() == id_userName && Arrays.hashCode( masterPassword ) == id_masterPassword &&
|
||||||
if (fullName.hashCode() == hc_userName && Arrays.hashCode( masterPassword ) == hc_masterPassword &&
|
version.ordinal() == id_version && masterKeyFuture != null && !masterKeyFuture.isCancelled())
|
||||||
masterKeyFuture != null && masterKeyFuture.get().getAlgorithmVersion() == version)
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
catch (InterruptedException | ExecutionException e) {
|
id_userName = fullName.hashCode();
|
||||||
return;
|
id_masterPassword = Arrays.hashCode( masterPassword );
|
||||||
}
|
id_version = version.ordinal();
|
||||||
hc_userName = fullName.hashCode();
|
|
||||||
hc_masterPassword = Arrays.hashCode( masterPassword );
|
|
||||||
|
|
||||||
if (preferences.isRememberFullName())
|
if (preferences.isRememberFullName())
|
||||||
preferences.setFullName( fullName );
|
preferences.setFullName( fullName );
|
||||||
@ -345,6 +343,10 @@ public class EmergencyActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void integrityTests(View view) {
|
public void integrityTests(View view) {
|
||||||
|
if (masterKeyFuture != null) {
|
||||||
|
masterKeyFuture.cancel( true );
|
||||||
|
masterKeyFuture = null;
|
||||||
|
}
|
||||||
TestActivity.startNoSkip( this );
|
TestActivity.startNoSkip( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ public class TestActivity extends Activity implements MPTestSuite.Listener {
|
|||||||
@InjectView(R.id.actionButton)
|
@InjectView(R.id.actionButton)
|
||||||
Button actionButton;
|
Button actionButton;
|
||||||
|
|
||||||
@InjectView(R.id.nativeKDF)
|
@InjectView(R.id.nativeKDFField)
|
||||||
CheckBox nativeKDF;
|
CheckBox nativeKDFField;
|
||||||
|
|
||||||
private MPTestSuite testSuite;
|
private MPTestSuite testSuite;
|
||||||
private ListenableFuture<Boolean> testFuture;
|
private ListenableFuture<Boolean> testFuture;
|
||||||
@ -59,10 +59,11 @@ public class TestActivity extends Activity implements MPTestSuite.Listener {
|
|||||||
setContentView( R.layout.activity_test );
|
setContentView( R.layout.activity_test );
|
||||||
ButterKnife.inject( this );
|
ButterKnife.inject( this );
|
||||||
|
|
||||||
nativeKDF.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() {
|
nativeKDFField.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
|
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
|
||||||
MasterKey.setAllowNativeByDefault( preferences.isAllowNativeKDF() );
|
preferences.setNativeKDFEnabled( isChecked );
|
||||||
|
MasterKey.setAllowNativeByDefault( isChecked );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ public class TestActivity extends Activity implements MPTestSuite.Listener {
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
nativeKDF.setChecked( preferences.isAllowNativeKDF() );
|
nativeKDFField.setChecked( preferences.isAllowNativeKDF() );
|
||||||
|
|
||||||
if (testFuture == null)
|
if (testFuture == null)
|
||||||
startTestSuite();
|
startTestSuite();
|
||||||
|
Loading…
Reference in New Issue
Block a user