diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/changepassNPin/presenter/ChangePassNPinViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/changepassNPin/presenter/ChangePassNPinViewModel.java index f4a78a53..65c463f6 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/changepassNPin/presenter/ChangePassNPinViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/changepassNPin/presenter/ChangePassNPinViewModel.java @@ -163,7 +163,7 @@ public class ChangePassNPinViewModel extends BaseViewModel implements ChangePass boolean isCurrentPasswordValid(CharSequence password) { - if(password!=null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")){ + if(password!=null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)){ this.currentPassword = password.toString(); changePassNPinLiveData.setCurrentPasswordInputLiveData(new FormInputStateDTO<>(true, null)); return true; @@ -176,7 +176,7 @@ public class ChangePassNPinViewModel extends BaseViewModel implements ChangePass boolean isNewPasswordValid(CharSequence password) { - if(password!=null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")){ + if(password!=null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)){ this.newPassword = password.toString(); changePassNPinLiveData.setNewPasswordInputLiveData(new FormInputStateDTO<>(true, null)); return true; @@ -189,7 +189,7 @@ public class ChangePassNPinViewModel extends BaseViewModel implements ChangePass } boolean isConfirmPasswordValid(CharSequence password) { - if(password!=null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")){ + if(password!=null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)){ this.confirmPassword = password.toString(); changePassNPinLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(true, null)); return true; diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/changepassword/presenter/ChangePasswordV2Presenter.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/changepassword/presenter/ChangePasswordV2Presenter.java index 33821a9b..6d56b711 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/changepassword/presenter/ChangePasswordV2Presenter.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/changepassword/presenter/ChangePasswordV2Presenter.java @@ -103,7 +103,7 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa private String confirmPassword; boolean isCurrentPasswordValid(CharSequence password) { - if(password!=null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")){ + if(password!=null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)){ this.currentPassword = password.toString(); changePasswordLiveData.setCurrentPasswordInputLiveData(new FormInputStateDTO<>(true, null)); return true; @@ -117,7 +117,7 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa boolean isNewPasswordValid(CharSequence password) { - if(password!=null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")){ + if(password!=null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)){ this.newPassword = password.toString(); changePasswordLiveData.setNewPasswordInputLiveData(new FormInputStateDTO<>(true, null)); return true; @@ -130,7 +130,7 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa } boolean isConfirmPasswordValid(CharSequence password) { - if(password!=null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")){ + if(password!=null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)){ this.confirmPassword = password.toString(); changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(true, null)); return true; diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/login/presenter/LoginV2ViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/login/presenter/LoginV2ViewModel.java index 76a50d67..db9d2bf6 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/login/presenter/LoginV2ViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/login/presenter/LoginV2ViewModel.java @@ -208,7 +208,7 @@ public class LoginV2ViewModel extends BaseViewModel implements LoginV2PresenterI } private boolean validatePassword(CharSequence password) { - if (password != null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")) { + if (password != null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)) { loginViewLiveData.setPasswordInputLiveData(new FormInputStateDTO<>(true, "")); this.password = password.toString(); return true; diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterViewModel.java index 4cc9ecdc..48bbe4e0 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterViewModel.java @@ -399,7 +399,7 @@ public class ExistingCustomerRegisterViewModel extends BaseViewModel implements } public boolean validatePassword(CharSequence password) { - if (password != null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")) { + if (password != null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)) { existingRegisterSubmitViewLiveData.setNewPasswordInputLiveData(new FormInputStateDTO<>(true, "")); this.password = password.toString(); return true; @@ -411,7 +411,7 @@ public class ExistingCustomerRegisterViewModel extends BaseViewModel implements } public boolean validateConfirmPassword(CharSequence password) { - if (password != null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")) { + if (password != null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)) { existingRegisterSubmitViewLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(true, "")); this.confirmPassword = password.toString(); return true; diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2Presenter.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2Presenter.java index 6e44dc0e..593079a8 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2Presenter.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2Presenter.java @@ -341,7 +341,7 @@ public class NewRegisterV2Presenter extends BaseViewModel implements NewRegister } private boolean validatePassword(CharSequence password) { - if (password != null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")) { + if (password != null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)) { newExistingRegisterViewLiveData.setPasswordInputLiveData(new FormInputStateDTO<>(true, "")); this.password = password.toString(); return true; @@ -353,7 +353,7 @@ public class NewRegisterV2Presenter extends BaseViewModel implements NewRegister } public boolean validateConfirmPassword(CharSequence password) { - if (password != null && password.toString().trim().matches("^(?=.*[A-Z])(?=.*[0-9]).{8,24}$")) { + if (password != null && password.toString().trim().matches(Constants.PASSWORD_PATTERN)) { newExistingRegisterViewLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(true, "")); this.confirmPassword = password.toString(); return true; diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/view/NewRegisterV2Activity.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/view/NewRegisterV2Activity.java index de8ccad1..b750e114 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/view/NewRegisterV2Activity.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/view/NewRegisterV2Activity.java @@ -143,6 +143,7 @@ public class NewRegisterV2Activity extends BaseActivity implements NewRegisterV2 } private void initialize() { + residenceId_edTxt.setFilters(new InputFilter[] {new InputFilter.AllCaps()}); this.presenter = new ViewModelProvider(this, new NewRegisterViewModelFactory(this)).get(NewRegisterV2Presenter.class); registerRelatedViewEvents = this.presenter.getRegisterRelatedViewEvents(new NewRegisterViewLiveData.RegisterViewBinding( RxTextView.textChanges(referralCodeEdTxt).skipInitialValue(), diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/Constants.java b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/Constants.java index 6805ff2f..c45e8914 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/Constants.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/Constants.java @@ -59,4 +59,6 @@ public class Constants { public static String CANCEL="Cancel"; public static String PAID="Paid"; + public static String PASSWORD_PATTERN="^(?=.*[A-Z])(?=.*[@#$%^_&+=])(?=.*[0-9]).{8,24}$"; + } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 52614483..197e01bd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1024,7 +1024,7 @@ All the configurations are done from backend web application system which allows Please make payment of to JME within next working day to transmit this request.\nAfter payment please check notices to get JME Number for this transfer. REQUEST SUMMARY - Password should contain atleast one number,one uppercase letter and minimum 8 Characters + Password should contain at least one number, one uppercase, one special character letter and minimum 8 Characters Send Money First Fragment