[英]Jquery.pwstrength password strength indicator rules not working
過去幾天,我一直在嘗試將密碼強度指示器實施到我正在處理的項目中,並決定使用 Jquery.pwstrength。
UI 工作正常,有兩個規則正在工作,即wordSequences
和wordRepetitions
,但是沒有其他規則被強制執行,但都被激活並附有分數。
這是我的代碼:
$(document).ready(function() {
options = {
common: {
minChar: 8,
debug: true
},
ruleScores: {
wordLength: -100,
wordRepititions: -100,
wordLowercase: 1,
wordUppercase: 3,
wordOneNumber: 3,
wordThreeNumbers: 5,
wordOneSpecialChar: 3,
wordTwoSpecialChar: 5,
wordUpperLowerCombo: 2,
wordLetterNumberCombo: 2,
wordLetterNumberCharCombo: 2
},
rules: {
wordSequences: true,
wordRepetitions: true,
wordLength: true,
wordLowercase: true,
wordUppercase: true,
wordOneNumber: true,
wordThreeNumbers: true,
wordOneSpecialChar: true,
wordTwoSpecialChar: true,
wordUpperLowerCombo: true,
wordLetterNumberCombo: true,
wordLetterNumberCharCombo: true
},
ui: {
showPopover: true,
showErrors: true,
showProgressBar: true
}
};
$('#password').pwstrength(options);
});
這是我在其上使用指標的 HTML 頁面:
<div class="form-group">
<form:label path="password" class="col-sm-2 control-label required">Password:</form:label>
<div class="col-sm-10">
<c:if test="${not empty passwordRequired}">
<form:input id="password" path="password" class="form-control" type="password" required="true" />
</c:if>
<c:if test="${empty passwordRequired}">
<form:input id="password" path="password" class="form-control" type="password" />
</c:if>
</div>
</div>
知道這里發生了什么嗎? 我也在 HTML 中包含了正確的文件。
我剛剛開始使用它,所以我對它了解不多,但我注意到在您的代碼中,規則分數缺少“wordSequences”,“wordRepititions”與“wordRepetitions”中的規則分數和規則也有所不同
如果不知道確切的包,就很難確定(名稱中包含 Jquery.pwstrength 的包不止一個)。 看起來你正在使用https://github.com/ablanco/jquery.pwstrength.bootstrap/blob/master/OPTIONS.md或類似的,在這種情況下你的options
對象是錯誤的,它需要一個activated
對象來保存rules
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.