Browse Source

Password should have at least one capital letter

master
preyearegmi 6 years ago
parent
commit
629b7f5320
  1. 23
      app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/presenter/ChangePasswordV2Presenter.java
  2. 10
      app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2Presenter.java
  3. 5
      app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/Utils.java

23
app/src/main/java/com/gmeremit/online/gmeremittance_native/changepasswordV2/presenter/ChangePasswordV2Presenter.java

@ -28,35 +28,26 @@ public class ChangePasswordV2Presenter extends BasePresenter implements ChangePa
boolean newPwdValidation=true; boolean newPwdValidation=true;
// if (!Utils.hasSpecialCharacters(currentPass)) {
// this.view.setCurrentPasswordError("Password must include at least one special character");
// currentPwdValidation= false;
// }
// if (!Utils.hasNumbers(currentPass)) {
// this.view.setCurrentPasswordError("Password must include at least one number");
// currentPwdValidation= false;
// }
// if (currentPass.length()>1&&currentPass.length()<9) {
// this.view.setCurrentPasswordError("Password should be greater than 8 character");
// currentPwdValidation= false;
// }
if(currentPass.trim().length()<1) if(currentPass.trim().length()<1)
{ {
this.view.setCurrentPasswordError("Password cannot be empty"); this.view.setCurrentPasswordError("Password cannot be empty");
currentPwdValidation= false; currentPwdValidation= false;
} }
if (!Utils.hasSpecialCharacters(newPwd)) { if (!Utils.hasSpecialCharacters(newPwd)) {
this.view.setNewPasswordError("Password must include at least one special character");
this.view.setNewPasswordError("Password should have at least one symbol");
newPwdValidation= false; newPwdValidation= false;
} }
if (!Utils.hasNumbers(newPwd)) { if (!Utils.hasNumbers(newPwd)) {
this.view.setNewPasswordError("Password must include at least one number");
this.view.setNewPasswordError("Password should have at least one number");
newPwdValidation= false; newPwdValidation= false;
} }
if (newPwd.length()>1&&newPwd.length()<9) { if (newPwd.length()>1&&newPwd.length()<9) {
this.view.setNewPasswordError("Password should be greater than 8 character");
this.view.setNewPasswordError("Password should have at least 9 characters");
newPwdValidation= false;
}
if (!Utils.hasAtleastOnCapitalLetter(newPwd)) {
this.view.setNewPasswordError("Password should have at least one capital letter");
newPwdValidation= false; newPwdValidation= false;
} }
if(newPwd.trim().length()<1) if(newPwd.trim().length()<1)

10
app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2Presenter.java

@ -39,15 +39,19 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres
if (!Utils.hasSpecialCharacters(pwdString)) { if (!Utils.hasSpecialCharacters(pwdString)) {
this.view.setPasswordError("Password must include at least one special character");
this.view.setPasswordError("Password should have at least one symbol");
pwdValidation= false; pwdValidation= false;
} }
if (!Utils.hasNumbers(pwdString)) { if (!Utils.hasNumbers(pwdString)) {
this.view.setPasswordError("Password must include at least one number");
this.view.setPasswordError("Password should have at least one number");
pwdValidation= false; pwdValidation= false;
} }
if (pwdString.length()>1&&pwdString.length()<9) { if (pwdString.length()>1&&pwdString.length()<9) {
this.view.setPasswordError("Password should be greater than 8 character");
this.view.setPasswordError("Password should have at least 9 characters");
pwdValidation= false;
}
if (!Utils.hasAtleastOnCapitalLetter(pwdString)) {
this.view.setPasswordError("Password should have at least one capital letter");
pwdValidation= false; pwdValidation= false;
} }
if(pwdString.trim().length()<1) if(pwdString.trim().length()<1)

5
app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/Utils.java

@ -722,4 +722,9 @@ public class Utils {
return outputDate; return outputDate;
} }
public static boolean hasAtleastOnCapitalLetter(String pwdString) {
return !pwdString.equals(pwdString.toLowerCase());
}
} }
Loading…
Cancel
Save