Disallow zero-length passphrases.

Fixes #2751
Closes #2762
This commit is contained in:
NorthwestBased 2015-03-23 19:37:31 -07:00 committed by Moxie Marlinspike
parent 472179b550
commit 6ec9ee89a7
2 changed files with 5 additions and 0 deletions

View file

@ -251,6 +251,7 @@
<!-- PassphraseChangeActivity -->
<string name="PassphraseChangeActivity_passphrases_dont_match_exclamation">Passphrases don\'t match!</string>
<string name="PassphraseChangeActivity_incorrect_old_passphrase_exclamation">Incorrect old passphrase!</string>
<string name="PassphraseChangeActivity_enter_new_passphrase_exclamation">Enter new passphrase!</string>
<!-- DeviceProvisioningActivity -->
<string name="DeviceProvisioningActivity_link_this_device">Link this device?</string>

View file

@ -96,6 +96,10 @@ public class PassphraseChangeActivity extends PassphraseActivity {
Toast.LENGTH_SHORT).show();
this.newPassphrase.setText("");
this.repeatPassphrase.setText("");
} else if (passphrase.equals("")) {
Toast.makeText(getApplicationContext(),
R.string.PassphraseChangeActivity_need_new_passphrase_exclamation,
Toast.LENGTH_SHORT).show();
} else {
MasterSecret masterSecret = MasterSecretUtil.changeMasterSecretPassphrase(this, original, passphrase);
TextSecurePreferences.setPasswordDisabled(this, false);