aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/scripts/4_input_pin.js
diff options
context:
space:
mode:
authorMarvin Borner2019-01-27 18:04:38 +0100
committerMarvin Borner2019-01-27 18:04:38 +0100
commitdfce4c5a178275f4b7226ae397226cbbf84571a8 (patch)
tree267bb6e3275e92dc8b781229f8087996ed1df753 /public/scripts/4_input_pin.js
parent46f92ac829cfaeb255317c99a0cb220e1ff6b071 (diff)
Added 3 retries
Diffstat (limited to 'public/scripts/4_input_pin.js')
-rw-r--r--public/scripts/4_input_pin.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/public/scripts/4_input_pin.js b/public/scripts/4_input_pin.js
index e0c96bd..b496e95 100644
--- a/public/scripts/4_input_pin.js
+++ b/public/scripts/4_input_pin.js
@@ -6,6 +6,8 @@ let pin = [];
* @param callback
*/
function init(callback) {
+ let tryCount = 0;
+
$('#1').focus().on('input', (el) => {
pin.push($(el.target).val());
$(el.target).val('*');
@@ -27,16 +29,16 @@ function init(callback) {
$('#4').on('input', (el) => {
pin.push($(el.target).val());
$(el.target).val('*');
- console.log(pin);
- callback(pin.join(''))
+ tryCount++;
+ callback(pin.join(''), tryCount)
});
}
/**
* Displays error message and clears input
*/
-function isWrong() {
- $('#pin_message').text('Passphrase is wrong!');
+function isWrong(message) {
+ $('#pin_message').text(message);
for (let i = 1; i < 5; i++) $(`#${i}`).val('');
$('#1').focus();
pin = [];