Skip to content

Commit dfd7298

Browse files
committed
Bugfix where wasCancelled was not reset upon recreating the GetTextFragment.
1 parent 7c847eb commit dfd7298

File tree

4 files changed

+4
-16
lines changed

4 files changed

+4
-16
lines changed

eclipse_projects/bVNC/res/values-ru/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@
316316
<string name="master_password_error_failed_to_enable">Не удалось включить мастер-пароль. Проверьте свободное место на Вашем устройстве и повторите попытку.</string>
317317
<string name="master_password_error_failed_to_disable">Не удалось отключить мастер-пароль. Проверьте свободное место на Вашем устройстве и повторите попытку.</string>
318318
<string name="master_password_error_password_necessary">Мастер-пароль требуется для того, чтобы продолжить.</string>
319+
<string name="master_password_error_password_not_set">Установка мастер-пароля была отменена.</string>
319320
<string name="master_password_error_wrong_password">Неправильный мастер-пароль введен.</string>
320321
<string name="master_password_hint_once">Введите Пароль</string>
321322
<string name="master_password_hint_twice">Повторите Пароль</string>

eclipse_projects/bVNC/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ If you are looking for a quick performance boost, try setting the Color mode to
317317
<string name="master_password_error_failed_to_enable">Could not enable master password. Check free space on your device and try again.</string>
318318
<string name="master_password_error_failed_to_disable">Could not disable master password. Check free space on your device and try again.</string>
319319
<string name="master_password_error_password_necessary">Master Password is required in order to continue, quitting.</string>
320+
<string name="master_password_error_password_not_set">Setting Master Password was cancelled.</string>
320321
<string name="master_password_error_wrong_password">Wrong Master Password entered, quitting.</string>
321322
<string name="master_password_hint_once">Enter Password</string>
322323
<string name="master_password_hint_twice">Repeat Password</string>

eclipse_projects/bVNC/src/com/iiordanov/bVNC/MainConfiguration.java

+1-15
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public abstract class MainConfiguration extends FragmentActivity implements GetT
3939
private final static String TAG = "MainConfiguration";
4040

4141
private boolean togglingMasterPassword = false;
42-
protected static PasswordManager passwordManager = null;
4342

4443
protected ConnectionBean selected;
4544
protected Database database;
@@ -356,20 +355,6 @@ private void toggleMasterPasswordState () {
356355
Log.i(TAG, "Toggled master password state");
357356
}
358357

359-
private void setMasterPasswordHash (String password) throws UnsupportedEncodingException,
360-
NoSuchAlgorithmException, InvalidKeySpecException {
361-
// Now compute and store the hash of the provided password and saved salt.
362-
String salt = PasswordManager.randomBase64EncodedString(Constants.saltLength);
363-
String hash = PasswordManager.computeHash(password, PasswordManager.b64Decode(salt));
364-
SharedPreferences sp = getSharedPreferences("generalSettings", Context.MODE_PRIVATE);
365-
Editor editor = sp.edit();
366-
editor.putString("masterPasswordSalt", salt);
367-
editor.putString("masterPasswordHash", hash);
368-
editor.apply();
369-
Log.i(TAG, "Setting master password hash.");
370-
//Log.i(TAG, String.format("hash: %s, salt: %s", hash, new String(PasswordManager.b64Decode(salt))));
371-
}
372-
373358
private boolean checkMasterPassword (String password) {
374359
Log.i(TAG, "Checking master password.");
375360
boolean result = false;
@@ -446,6 +431,7 @@ public void handlePasword(String providedPassword, boolean wasCancelled) {
446431
} else {
447432
// No need to show error message because user cancelled consciously.
448433
Log.i(TAG, "Dialog cancelled, not setting master password.");
434+
Utils.showErrorMessage(this, getResources().getString(R.string.master_password_error_password_not_set));
449435
}
450436
removeGetPasswordFragments();
451437
arriveOnPage();

eclipse_projects/bVNC/src/com/iiordanov/bVNC/dialogs/GetTextFragment.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ public void onCreate(Bundle savedInstanceState) {
106106
@Override
107107
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
108108
android.util.Log.i(TAG, "onCreateView called");
109+
wasCancelled = false;
109110

110111
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN|WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
111112

112113
// Set title for this dialog
113114
getDialog().setTitle(title);
114115
View v = null;
115-
116116

117117
switch (dialogType) {
118118
case Plaintext:

0 commit comments

Comments
 (0)