Merge branch 'Device_lock' into 'master'

Add maximum fails attempts to passcode policy

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

@ -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() {

@ -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;

@ -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 = {};

@ -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();

@ -325,27 +325,27 @@
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="passcodePolicyMaxFailedAttempts">
Maximum number of failed attempts
<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">
<label class="wr-input-label" for="maximumNumberOfFailedAttemptsBeforeDeviceWipe">
Maximum number of failed attempts before device reset
<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.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<select id="passcode-policy-max-failed-attempts" class="form-control operationDataKeys"
data-key="passcodePolicyMaxFailedAttempts" data-default="0">
<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>
<input id="Maximum-number-of-failed-attempts-before-device-wipe" type="text" class="form-control operationDataKeys"
data-key="maximumNumberOfFailedAttemptsBeforeDeviceWipe" maxlength="2">
</div>
<div class="wr-input-control">

@ -309,27 +309,29 @@
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="passcodePolicyMaxFailedAttempts">
Maximum number of failed attempts
<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"
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"
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>
</label>
<select id="passcode-policy-max-failed-attempts" class="form-control operationDataKeys"
data-key="passcodePolicyMaxFailedAttempts" data-default="0" disabled>
<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>
<input id="Maximum-number-of-failed-attempts-before-device-wipe" type="text" class="form-control operationDataKeys"
data-key="maximumNumberOfFailedAttemptsBeforeDeviceWipe" maxlength="2"
placeholder="[ Requires Number Input ]" disabled>
</div>
<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
if (continueToCheckNextInputs) {
var passcodePolicyPasscodeHistory = $("input#passcode-policy-passcode-history").val();

@ -332,28 +332,28 @@
data-key="passcodePolicyPasscodeHistory" maxlength="2">
</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">
<label class="wr-input-label" for="passcodePolicyMaxFailedAttempts">
Maximum number of failed attempts
<label class="wr-input-label" for="maximumNumberOfFailedAttemptsBeforeDeviceWipe">
Maximum number of failed attempts before device reset
<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.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<select id="passcode-policy-max-failed-attempts" class="form-control operationDataKeys"
data-key="passcodePolicyMaxFailedAttempts" data-default="0">
<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>
<input id="Maximum-number-of-failed-attempts-before-device-wipe" type="text" class="form-control operationDataKeys"
data-key="maximumNumberOfFailedAttemptsBeforeDeviceWipe" maxlength="2">
</div>
<div class="wr-input-control">

Loading…
Cancel
Save