Merge branch 'Device_lock' into 'master'

Add maximum fails attempts to passcode policy

See merge request entgra/carbon-device-mgt-plugins!146
revert-dabc3590
Charitha Goonetilleke 5 years ago
commit 1014b7e1f9

@ -31,13 +31,20 @@ import java.io.Serializable;
+ "password policy") + "password policy")
public class PasscodePolicy extends AndroidOperation implements Serializable { public class PasscodePolicy extends AndroidOperation implements Serializable {
@ApiModelProperty(name = "maxFailedAttempts", value = "The maximum number of times the end-user can enter" @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" + " 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 " + " OS when the failed attempts exceed the maximum failed attempts. Android devices will be "
+ "automatically reset to the original factory settings", required = true) + "automatically locked and admin can unlock the device", required = true)
@Max(10) @Max(10)
private int maxFailedAttempts; 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 " @ApiModelProperty(name = "minLength", value = "The minimum number of alphanumerical values that the "
+ "end-user can enter as his/her passcode", required = true) + "end-user can enter as his/her passcode", required = true)
@Max(15) @Max(15)
@ -63,12 +70,12 @@ public class PasscodePolicy extends AndroidOperation implements Serializable {
+ "Minimum length\n" + "Minimum complex characters", required = true) + "Minimum length\n" + "Minimum complex characters", required = true)
private boolean allowSimple; private boolean allowSimple;
public int getMaxFailedAttempts() { public int getMaxFailedAttemptsDeviceLock(){
return maxFailedAttempts; return maxFailedAttemptsDeviceLock;
} }
public void setMaxFailedAttempts(int maxFailedAttempts) { public int getMaxFailedAttemptsDeviceWipe(){
this.maxFailedAttempts = maxFailedAttempts; return maxFailedAttemptsDeviceWipe;
} }
public int getMinLength() { public int getMinLength() {

@ -481,7 +481,8 @@ var generatePayload = function (operationCode, operationData, deviceList) {
"minComplexChars": operationData["passcodePolicyMinComplexChars"], "minComplexChars": operationData["passcodePolicyMinComplexChars"],
"maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"],
"pinHistory": operationData["passcodePolicyPasscodeHistory"], "pinHistory": operationData["passcodePolicyPasscodeHistory"],
"maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"] "maxFailedAttemptsDeviceLock": operationData["maximumNumberOfFailedAttemptsBeforeDeviceLock"],
"maxFailedAttemptsDeviceWipe": operationData["maximumNumberOfFailedAttemptsBeforeDeviceWipe"]
} }
}; };
break; break;

@ -135,7 +135,8 @@ var androidOperationModule = function () {
"passcodePolicyMinComplexChars": operationPayload["minComplexChars"], "passcodePolicyMinComplexChars": operationPayload["minComplexChars"],
"passcodePolicyMaxPasscodeAgeInDays": operationPayload["maxPINAgeInDays"], "passcodePolicyMaxPasscodeAgeInDays": operationPayload["maxPINAgeInDays"],
"passcodePolicyPasscodeHistory": operationPayload["pinHistory"], "passcodePolicyPasscodeHistory": operationPayload["pinHistory"],
"passcodePolicyMaxFailedAttempts": operationPayload["maxFailedAttempts"], "maximumNumberOfFailedAttemptsBeforeDeviceLock": operationPayload["maxFailedAttemptsDeviceLock"],
"maximumNumberOfFailedAttemptsBeforeDeviceWipe": operationPayload["maxFailedAttemptsDeviceWipe"]
"passcodePolicyMaxTimeToLock": operationPayload["maxTimeToLock"], "passcodePolicyMaxTimeToLock": operationPayload["maxTimeToLock"],
"passcodePolicyWPExist": operationPayload["passcodePolicyWPExist"] "passcodePolicyWPExist": operationPayload["passcodePolicyWPExist"]
}; };
@ -576,9 +577,10 @@ var androidOperationModule = function () {
"minComplexChars": operationData["passcodePolicyMinComplexChars"], "minComplexChars": operationData["passcodePolicyMinComplexChars"],
"maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"],
"pinHistory": operationData["passcodePolicyPasscodeHistory"], "pinHistory": operationData["passcodePolicyPasscodeHistory"],
"maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"],
"maxTimeToLock": operationData["passcodePolicyMaxTimeToLock"], "maxTimeToLock": operationData["passcodePolicyMaxTimeToLock"],
"passcodePolicyWPExist": operationData["passcodePolicyWPExist"] "passcodePolicyWPExist": operationData["passcodePolicyWPExist"]
"maxFailedAttemptsDeviceLock": operationData["maximumNumberOfFailedAttemptsBeforeDeviceLock"],
"maxFailedAttemptsDeviceWipe": operationData["maximumNumberOfFailedAttemptsBeforeDeviceWipe"]
} }
}; };
workProfilePasscode = {}; workProfilePasscode = {};

@ -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 // validating second and last input: passcodePolicyPasscodeHistory
if (continueToCheckNextInputs) { if (continueToCheckNextInputs) {
var passcodePolicyPasscodeHistory = $("input#passcode-policy-passcode-history").val(); var passcodePolicyPasscodeHistory = $("input#passcode-policy-passcode-history").val();

@ -325,27 +325,27 @@
</div> </div>
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="passcodePolicyMaxFailedAttempts"> <label class="wr-input-label" for="maximumNumberOfFailedAttemptsBeforeDeviceLock">
Maximum number of failed attempts Maximum number of failed attempts before device lock
<span class="helper"
title="The maximum number of incorrect password entries allowed. If the correct password is not entered within the allowed number of attempts, the device will be locked.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="Maximum-number-of-failed-attempts-before-device-lock" type="text" class="form-control operationDataKeys"
data-key="maximumNumberOfFailedAttemptsBeforeDeviceLock" maxlength="2">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="maximumNumberOfFailedAttemptsBeforeDeviceWipe">
Maximum number of failed attempts before device reset
<span class="helper" <span class="helper"
title="The maximum number of incorrect password entries allowed. If the correct password is not entered within the allowed number of attempts, the data on the device will be erased."> title="The maximum number of incorrect password entries allowed. If the correct password is not entered within the allowed number of attempts, the data on the device will be erased.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
</label> </label>
<select id="passcode-policy-max-failed-attempts" class="form-control operationDataKeys" <input id="Maximum-number-of-failed-attempts-before-device-wipe" type="text" class="form-control operationDataKeys"
data-key="passcodePolicyMaxFailedAttempts" data-default="0"> data-key="maximumNumberOfFailedAttemptsBeforeDeviceWipe" maxlength="2">
<option value="" selected="selected">
None
</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
</select>
</div> </div>
<div class="wr-input-control"> <div class="wr-input-control">

@ -309,27 +309,29 @@
</div> </div>
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="passcodePolicyMaxFailedAttempts"> <label class="wr-input-label" for="maximumNumberOfFailedAttemptsBeforeDeviceLock">
Maximum number of failed attempts Maximum number of failed attempts before device lock
<span class="helper"
title="The maximum number of incorrect password entries allowed. If the correct password is not entered within the allowed number of attempts, the device will be locked.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="Maximum-number-of-failed-attempts-before-device-lock" type="text" class="form-control operationDataKeys"
data-key="maximumNumberOfFailedAttemptsBeforeDeviceLock" maxlength="2"
placeholder="[ Requires Number Input ]" disabled>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="maximumNumberOfFailedAttemptsBeforeDeviceWipe">
Maximum number of failed attempts before device reset
<span class="helper" <span class="helper"
title="The maximum number of incorrect password entries allowed. If the correct password is not entered within the allowed number of attempts, the data on the device will be erased."> title="The maximum number of incorrect password entries allowed. If the correct password is not entered within the allowed number of attempts, the data on the device will be erased.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
</label> </label>
<select id="passcode-policy-max-failed-attempts" class="form-control operationDataKeys" <input id="Maximum-number-of-failed-attempts-before-device-wipe" type="text" class="form-control operationDataKeys"
data-key="passcodePolicyMaxFailedAttempts" data-default="0" disabled> data-key="maximumNumberOfFailedAttemptsBeforeDeviceWipe" maxlength="2"
<option value="" selected="selected"> placeholder="[ Requires Number Input ]" disabled>
None
</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
</select>
</div> </div>
<div class="wr-input-control"> <div class="wr-input-control">

@ -310,6 +310,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 // validating second and last input: passcodePolicyPasscodeHistory
if (continueToCheckNextInputs) { if (continueToCheckNextInputs) {
var passcodePolicyPasscodeHistory = $("input#passcode-policy-passcode-history").val(); var passcodePolicyPasscodeHistory = $("input#passcode-policy-passcode-history").val();

@ -332,28 +332,28 @@
data-key="passcodePolicyPasscodeHistory" maxlength="2"> data-key="passcodePolicyPasscodeHistory" maxlength="2">
</div> </div>
<div class="wr-input-control">maximumNumberOfFailedAttemptsBeforeDeviceLock
<label class="wr-input-label" for="maximumNumberOfFailedAttemptsBeforeDeviceLock">
Maximum number of failed attempts before device lock
<span class="helper"
title="The maximum number of incorrect password entries allowed. If the correct password is not entered within the allowed number of attempts, the device will be locked.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="Maximum-number-of-failed-attempts-before-device-lock" type="text" class="form-control operationDataKeys"
data-key="maximumNumberOfFailedAttemptsBeforeDeviceLock" maxlength="2">
</div>
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="passcodePolicyMaxFailedAttempts"> <label class="wr-input-label" for="maximumNumberOfFailedAttemptsBeforeDeviceWipe">
Maximum number of failed attempts Maximum number of failed attempts before device reset
<span class="helper" <span class="helper"
title="The maximum number of incorrect password entries allowed. If the correct password is not entered within the allowed number of attempts, the data on the device will be erased."> title="The maximum number of incorrect password entries allowed. If the correct password is not entered within the allowed number of attempts, the data on the device will be erased.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
</label> </label>
<select id="passcode-policy-max-failed-attempts" class="form-control operationDataKeys" <input id="Maximum-number-of-failed-attempts-before-device-wipe" type="text" class="form-control operationDataKeys"
data-key="passcodePolicyMaxFailedAttempts" data-default="0"> data-key="maximumNumberOfFailedAttemptsBeforeDeviceWipe" maxlength="2">
<option value="" selected="selected">
None
</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
</select>
</div> </div>
<div class="wr-input-control"> <div class="wr-input-control">

Loading…
Cancel
Save