fix(wallet): clear login and recovery credentials
This commit is contained in:
+18
-5
@@ -29,6 +29,11 @@ import org.chromium.chrome.browser.crypto_wallet.util.Utils;
|
||||
import org.chromium.ui.widget.Toast;
|
||||
|
||||
public class RestoreWalletFragment extends CryptoOnboardingFragment {
|
||||
private EditText recoveryPhraseText;
|
||||
private EditText passwordEdittext;
|
||||
private EditText retypePasswordEdittext;
|
||||
private CheckBox showRecoveryPhraseCheckbox;
|
||||
|
||||
private KeyringService getKeyringService() {
|
||||
Activity activity = getActivity();
|
||||
if (activity instanceof BraveWalletActivity) {
|
||||
@@ -47,14 +52,16 @@ public class RestoreWalletFragment extends CryptoOnboardingFragment {
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
EditText recoveryPhraseText = view.findViewById(R.id.recovery_phrase_text);
|
||||
recoveryPhraseText = view.findViewById(R.id.recovery_phrase_text);
|
||||
passwordEdittext = view.findViewById(R.id.restore_wallet_password);
|
||||
retypePasswordEdittext = view.findViewById(R.id.restore_wallet_retype_password);
|
||||
showRecoveryPhraseCheckbox = view.findViewById(R.id.restore_wallet_checkbox);
|
||||
|
||||
ImageView restoreWalletCopyImage = view.findViewById(R.id.restore_wallet_copy_image);
|
||||
assert getActivity() != null;
|
||||
restoreWalletCopyImage.setOnClickListener(
|
||||
v -> recoveryPhraseText.setText(Utils.getTextFromClipboard(getActivity())));
|
||||
|
||||
CheckBox showRecoveryPhraseCheckbox = view.findViewById(R.id.restore_wallet_checkbox);
|
||||
showRecoveryPhraseCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (isChecked) {
|
||||
recoveryPhraseText.setTransformationMethod(
|
||||
@@ -67,7 +74,6 @@ public class RestoreWalletFragment extends CryptoOnboardingFragment {
|
||||
|
||||
Button secureCryptoButton = view.findViewById(R.id.btn_restore_wallet);
|
||||
secureCryptoButton.setOnClickListener(v -> {
|
||||
EditText passwordEdittext = view.findViewById(R.id.restore_wallet_password);
|
||||
String passwordInput = passwordEdittext.getText().toString();
|
||||
|
||||
KeyringService keyringService = getKeyringService();
|
||||
@@ -86,7 +92,6 @@ public class RestoreWalletFragment extends CryptoOnboardingFragment {
|
||||
|
||||
private void proceedWithAStrongPassword(
|
||||
String passwordInput, View view, EditText recoveryPhraseText) {
|
||||
EditText retypePasswordEdittext = view.findViewById(R.id.restore_wallet_retype_password);
|
||||
String retypePasswordInput = retypePasswordEdittext.getText().toString();
|
||||
|
||||
if (!passwordInput.equals(retypePasswordInput)) {
|
||||
@@ -105,6 +110,7 @@ public class RestoreWalletFragment extends CryptoOnboardingFragment {
|
||||
Utils.clearClipboard(recoveryPhraseText.getText().toString().trim(), 0);
|
||||
Utils.clearClipboard(passwordInput, 0);
|
||||
Utils.clearClipboard(retypePasswordInput, 0);
|
||||
cleanUp();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), R.string.account_recovery_failed,
|
||||
Toast.LENGTH_SHORT)
|
||||
@@ -113,4 +119,11 @@ public class RestoreWalletFragment extends CryptoOnboardingFragment {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanUp() {
|
||||
recoveryPhraseText.getText().clear();
|
||||
passwordEdittext.getText().clear();
|
||||
retypePasswordEdittext.getText().clear();
|
||||
showRecoveryPhraseCheckbox.setChecked(false);
|
||||
}
|
||||
}
|
||||
+1
@@ -91,6 +91,7 @@ public class UnlockWalletFragment extends CryptoOnboardingFragment {
|
||||
mUnlockWalletRestoreButton.setOnClickListener(v -> {
|
||||
if (onNextPage != null) {
|
||||
onNextPage.gotoRestorePage();
|
||||
mUnlockWalletPassword.getText().clear();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user