mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-15 14:32:49 +00:00
Merge pull request #325 from michaelschattgen/fix-confirm-password
Improve confirm password functionality
This commit is contained in:
commit
3d51b84188
2 changed files with 10 additions and 8 deletions
|
@ -93,11 +93,12 @@ public class Dialogs {
|
|||
switchToggleVisibility.setOnCheckedChangeListener((CompoundButton.OnCheckedChangeListener) (buttonView, isChecked) -> {
|
||||
if (isChecked) {
|
||||
textPassword.setTransformationMethod(null);
|
||||
textPasswordConfirm.setTransformationMethod(null);
|
||||
textPassword.clearFocus();
|
||||
textPasswordConfirm.setEnabled(false);
|
||||
textPasswordConfirm.clearFocus();
|
||||
} else {
|
||||
textPassword.setTransformationMethod(new PasswordTransformationMethod());
|
||||
textPasswordConfirm.setEnabled(true);
|
||||
textPasswordConfirm.setTransformationMethod(new PasswordTransformationMethod());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -116,7 +117,7 @@ public class Dialogs {
|
|||
|
||||
// replace the default listener
|
||||
button.setOnClickListener(v -> {
|
||||
if (!EditTextHelper.areEditTextsEqual(textPassword, textPasswordConfirm) && !switchToggleVisibility.isChecked()) {
|
||||
if (!EditTextHelper.areEditTextsEqual(textPassword, textPasswordConfirm)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -141,7 +142,7 @@ public class Dialogs {
|
|||
TextWatcher watcher = new TextWatcher() {
|
||||
public void onTextChanged(CharSequence c, int start, int before, int count) {
|
||||
boolean equal = EditTextHelper.areEditTextsEqual(textPassword, textPasswordConfirm);
|
||||
buttonOK.get().setEnabled(equal || switchToggleVisibility.isChecked());
|
||||
buttonOK.get().setEnabled(equal);
|
||||
}
|
||||
|
||||
public void beforeTextChanged(CharSequence c, int start, int count, int after) {
|
||||
|
|
|
@ -45,11 +45,12 @@ public class CustomAuthenticatedSlide extends Fragment implements ISlidePolicy,
|
|||
_checkPasswordVisibility.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (isChecked) {
|
||||
_textPassword.setTransformationMethod(null);
|
||||
_textPasswordConfirm.setTransformationMethod(null);
|
||||
_textPassword.clearFocus();
|
||||
_textPasswordConfirm.setEnabled(false);
|
||||
_textPasswordConfirm.clearFocus();
|
||||
} else {
|
||||
_textPassword.setTransformationMethod(new PasswordTransformationMethod());
|
||||
_textPasswordConfirm.setEnabled(true);
|
||||
_textPasswordConfirm.setTransformationMethod(new PasswordTransformationMethod());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -113,7 +114,7 @@ public class CustomAuthenticatedSlide extends Fragment implements ISlidePolicy,
|
|||
// intentional fallthrough
|
||||
case CustomAuthenticationSlide.CRYPT_TYPE_PASS:
|
||||
if (EditTextHelper.getEditTextChars(_textPassword).length > 0) {
|
||||
return EditTextHelper.areEditTextsEqual(_textPassword, _textPasswordConfirm) || _checkPasswordVisibility.isChecked();
|
||||
return EditTextHelper.areEditTextsEqual(_textPassword, _textPasswordConfirm);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -125,7 +126,7 @@ public class CustomAuthenticatedSlide extends Fragment implements ISlidePolicy,
|
|||
@Override
|
||||
public void onUserIllegallyRequestedNextPage() {
|
||||
String message;
|
||||
if (!EditTextHelper.areEditTextsEqual(_textPassword, _textPasswordConfirm) && !_checkPasswordVisibility.isChecked()) {
|
||||
if (!EditTextHelper.areEditTextsEqual(_textPassword, _textPasswordConfirm)) {
|
||||
message = getString(R.string.password_equality_error);
|
||||
|
||||
View view = getView();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue