diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/PasscodePolicy.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/PasscodePolicy.java index 8cd56e51e..3d29bb60d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/PasscodePolicy.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/PasscodePolicy.java @@ -31,13 +31,20 @@ import java.io.Serializable; + "password policy") public class PasscodePolicy extends AndroidOperation implements Serializable { - @ApiModelProperty(name = "maxFailedAttempts", value = "The maximum number of times the end-user can enter" - + " his/her device passcode incorrectly. EMM will take different courses of action based on the" - + " OS when the failed attempts exceed the maximum failed attempts. Android devices will be " - + "automatically reset to the original factory settings", required = true) - - @Max(10) - private int maxFailedAttempts; + @ApiModelProperty(name = "maxFailedAttemptsDeviceLock", value = "The maximum number of times the end-user can enter" + + " his/her device passcode incorrectly. EMM will take different courses of action based on the" + + " OS when the failed attempts exceed the maximum failed attempts. Android devices will be " + + "automatically locked and admin can unlock the device", required = true) + + @Max(10) + private int maxFailedAttemptsDeviceLock; + @ApiModelProperty(name = "maxFailedAttemptsDeviceWipe", value = "The maximum number of times the end-user can enter" + + " his/her device passcode incorrectly. EMM will take different courses of action based on the" + + " OS when the failed attempts exceed the maximum failed attempts. Android devices will be " + + "automatically wiped to factory settings", required = true) + + @Max(10) + private int maxFailedAttemptsDeviceWipe; @ApiModelProperty(name = "minLength", value = "The minimum number of alphanumerical values that the " + "end-user can enter as his/her passcode", required = true) @Max(15) @@ -63,12 +70,12 @@ public class PasscodePolicy extends AndroidOperation implements Serializable { + "Minimum length\n" + "Minimum complex characters", required = true) private boolean allowSimple; - public int getMaxFailedAttempts() { - return maxFailedAttempts; + public int getMaxFailedAttemptsDeviceLock(){ + return maxFailedAttemptsDeviceLock; } - public void setMaxFailedAttempts(int maxFailedAttempts) { - this.maxFailedAttempts = maxFailedAttempts; + public int getMaxFailedAttemptsDeviceWipe(){ + return maxFailedAttemptsDeviceWipe; } public int getMinLength() { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js index 3aa3e7d42..f25c05693 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js @@ -481,7 +481,8 @@ var generatePayload = function (operationCode, operationData, deviceList) { "minComplexChars": operationData["passcodePolicyMinComplexChars"], "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], "pinHistory": operationData["passcodePolicyPasscodeHistory"], - "maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"] + "maxFailedAttemptsDeviceLock": operationData["maximumNumberOfFailedAttemptsBeforeDeviceLock"], + "maxFailedAttemptsDeviceWipe": operationData["maximumNumberOfFailedAttemptsBeforeDeviceWipe"] } }; break; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js index 98c10f832..5d640f106 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js @@ -135,7 +135,8 @@ var androidOperationModule = function () { "passcodePolicyMinComplexChars": operationPayload["minComplexChars"], "passcodePolicyMaxPasscodeAgeInDays": operationPayload["maxPINAgeInDays"], "passcodePolicyPasscodeHistory": operationPayload["pinHistory"], - "passcodePolicyMaxFailedAttempts": operationPayload["maxFailedAttempts"], + "maximumNumberOfFailedAttemptsBeforeDeviceLock": operationPayload["maxFailedAttemptsDeviceLock"], + "maximumNumberOfFailedAttemptsBeforeDeviceWipe": operationPayload["maxFailedAttemptsDeviceWipe"] "passcodePolicyMaxTimeToLock": operationPayload["maxTimeToLock"], "passcodePolicyWPExist": operationPayload["passcodePolicyWPExist"] }; @@ -576,9 +577,10 @@ var androidOperationModule = function () { "minComplexChars": operationData["passcodePolicyMinComplexChars"], "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], "pinHistory": operationData["passcodePolicyPasscodeHistory"], - "maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"], "maxTimeToLock": operationData["passcodePolicyMaxTimeToLock"], "passcodePolicyWPExist": operationData["passcodePolicyWPExist"] + "maxFailedAttemptsDeviceLock": operationData["maximumNumberOfFailedAttemptsBeforeDeviceLock"], + "maxFailedAttemptsDeviceWipe": operationData["maximumNumberOfFailedAttemptsBeforeDeviceWipe"] } }; workProfilePasscode = {}; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js index 4b2bc2bf2..02059ce19 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js @@ -368,6 +368,21 @@ var validatePolicyProfile = function () { } } + //validating davice lock fail attempts for device wipe + var passcodePolicyMaxfailAttemptsForDeviceLock = $("input#Maximum-number-of-failed-attempts-before-device-lock").val(); + var passcodePolicyMaxfailAttemptsForDeviceWipe = $("input#Maximum-number-of-failed-attempts-before-device-wipe").val(); + + if (passcodePolicyMaxfailAttemptsForDeviceLock && passcodePolicyMaxfailAttemptsForDeviceWipe) { + if (passcodePolicyMaxfailAttemptsForDeviceLock >= passcodePolicyMaxfailAttemptsForDeviceWipe) { + validationStatus = { + "error": true, + "subErrorMsg": "Provided maximum faild attempts for device wipe should be grater than device lock fail attempts.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + // validating second and last input: passcodePolicyPasscodeHistory if (continueToCheckNextInputs) { var passcodePolicyPasscodeHistory = $("input#passcode-policy-passcode-history").val(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs index f57a3bd5c..838369bb9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs @@ -325,27 +325,27 @@