|
@ -87,6 +87,7 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void changePassword() { |
|
|
public void changePassword() { |
|
|
|
|
|
if (changePasswordValidator.doesConfirmPasswordMatchWithNewPassword()) { |
|
|
useCaseCompositeDisposable.add( |
|
|
useCaseCompositeDisposable.add( |
|
|
this.gateway.performChangePassRequest(this.gateway.getAuth(), this.gateway.getUserID(), this.changePasswordValidator.currentPassword, this.changePasswordValidator.newPassword, this.changePasswordValidator.confirmPassword) |
|
|
this.gateway.performChangePassRequest(this.gateway.getAuth(), this.gateway.getUserID(), this.changePasswordValidator.currentPassword, this.changePasswordValidator.newPassword, this.changePasswordValidator.confirmPassword) |
|
|
.doOnSubscribe(d -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text))) |
|
|
.doOnSubscribe(d -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text))) |
|
@ -95,6 +96,7 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa |
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
.subscribeWith(new ChangePasswordObserver(this.changePasswordValidator.newPassword))); |
|
|
.subscribeWith(new ChangePasswordObserver(this.changePasswordValidator.newPassword))); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class ChangePasswordValidator { |
|
|
private class ChangePasswordValidator { |
|
@ -130,12 +132,19 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean doesConfirmPasswordMatchWithNewPassword() { |
|
|
|
|
|
boolean result = (confirmPassword != null && confirmPassword.equalsIgnoreCase(newPassword)); |
|
|
|
|
|
changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(result, getStringfromStringId(R.string.confirm_password_mismatch_error))); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean isConfirmPasswordValid(CharSequence password) { |
|
|
boolean isConfirmPasswordValid(CharSequence password) { |
|
|
if (password != null && password.length() > 0) { |
|
|
if (password != null && password.length() > 0) { |
|
|
this.confirmPassword = password.toString(); |
|
|
this.confirmPassword = password.toString(); |
|
|
changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(true, null)); |
|
|
changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(true, null)); |
|
|
return true; |
|
|
return true; |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.currentPassword = null; |
|
|
this.currentPassword = null; |
|
|
changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(false, getStringfromStringId(R.string.password_empty_error))); |
|
|
changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(false, getStringfromStringId(R.string.password_empty_error))); |
|
@ -212,7 +221,4 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |