Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorTobias Speicher <rootcommander@gmail.com>2022-03-24 18:54:21 +0300
committerTobias Speicher <rootcommander@gmail.com>2022-03-24 18:55:03 +0300
commit3abba5338e2b4cdbf8acd574e924e45338556ed6 (patch)
tree85060f3c67ef2e654918f523a2d8860f515869c2 /js
parent0845c898acddcb442d2eb7c8c57271c8814228b5 (diff)
Replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
Diffstat (limited to 'js')
-rw-r--r--js/app/directives/otp.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/js/app/directives/otp.js b/js/app/directives/otp.js
index 69e5b608..cfcc40ce 100644
--- a/js/app/directives/otp.js
+++ b/js/app/directives/otp.js
@@ -54,7 +54,7 @@
}
for (i = 0; i + 4 <= bits.length; i += 4) {
- var chunk = bits.substr(i, 4);
+ var chunk = bits.slice(i, i + 4);
hex = hex + parseInt(chunk, 2).toString(16);
}
return hex.length % 2 ? hex + "0" : hex;
@@ -91,8 +91,8 @@
var hmacObj = new jsSHA(time, 'HEX');
var hmac = hmacObj.getHMAC(key, 'HEX', 'SHA-1', "HEX");
var offset = hex2dec(hmac.substring(hmac.length - 1));
- var otp = (hex2dec(hmac.substr(offset * 2, 8)) & hex2dec('7fffffff')) + '';
- otp = (otp).substr(otp.length - 6, 6);
+ var otp = (hex2dec(hmac.slice(offset * 2, offset * 2 + 8)) & hex2dec('7fffffff')) + '';
+ otp = (otp).slice(-6);
scope.otp = otp;
};