The keyboard:
<div class="password-keyboard">
<div class="row">
<div class="col-md-4">
<button class="btn btn-light btn-block" id="btnNumber_1" onclick="digitaCaracter('1')">1 ou 8</button>
<input type="hidden" id="btnNumberVal_1" name="btnNumber[]" value="1,8" />
</div>
<div class="col-md-4">
<button class="btn btn-light btn-block" id="btnNumber_2" onclick="digitaCaracter('2')">7 ou 2</button>
<input type="hidden" id="btnNumberVal_2" name="btnNumber[]" value="7,2" />
</div>
<div class="col-md-4">
<button class="btn btn-light btn-block" id="btnNumber_3" onclick="digitaCaracter('3')">5 ou 4</button>
<input type="hidden" id="btnNumberVal_3" name="btnNumber[]" value="5,4" />
</div>
<div class="col-md-4">
<button class="btn btn-light btn-block" id="btnNumber_4" onclick="digitaCaracter('4')">3 ou 6</button>
<input type="hidden" id="btnNumberVal_4" name="btnNumber[]" value="3,6" />
</div>
<div class="col-md-4">
<button class="btn btn-light btn-block" id="btnNumber_5" onclick="digitaCaracter('5')">9 ou 0</button>
<input type="hidden" id="btnNumberVal_5" name="btnNumber[]" value="9,0" />
</div>
<div class="col-md-4">
<a class="btn btn-light btn-block" onclick="removeCaracter()"><i class="fa fa-arrow-left"></i></a>
</div>
</div>
Each time you open the keyboard, the digits change:
for (var array=[],i=0;i<=9;++i) array[i]=i;
// http://stackoverflow.com/questions/962802#962890
var tmp, current, top = array.length;
if(top) while(--top) {
current = Math.floor(Math.random() * (top + 1));
tmp = array[current];
array[current] = array[top];
array[top] = tmp;
}
var nmbArr = array;
for (var i = 0; i<=4; i++) {
$('#btnNumber_'+(i+1)).html(nmbArr[i*2]+' ou '+nmbArr[(i*2)+1]);
$('#btnNumberVal_'+(i+1)).val(nmbArr[i*2]+','+nmbArr[(i*2)+1]);
}
The keyboard is working which is a beauty:
Thebeingsentisbeingcaughtnormal.The"problem" is how I am going to do to compare the combinations with the user password that is in hashing bcrypt
Does anyone have an idea how I'm going to validate these combinations? Will I have to check 64 times (2 ^ 6) ???