Merge pull request #47 from Slixor/master

Fix Password Generation in Internet Explorer 11
This commit is contained in:
Christoph Wiechert
2018-03-13 15:02:51 +01:00
committed by GitHub

View File

@@ -29,11 +29,19 @@
_pattern : /[A-Z0-9_\-\+\!]/,
_getRandomByte: function() {
const result = new Uint8Array(1);
window.crypto.getRandomValues(result);
var fixedcrypto = window.msCrypto;
if (!fixedcrypto) {
var fixedcrypto = window.crypto;
}
fixedcrypto.getRandomValues(result);
return result[0];
},
generate: function(length) {
if(!window.crypto || !window.crypto.getRandomValues) return '';
var fixedcrypto2 = window.msCrypto;
if (!fixedcrypto2) {
var fixedcrypto2 = window.crypto;
}
if(!fixedcrypto2 || !fixedcrypto2.getRandomValues) return '';
return Array.apply(null, {'length': length}).map(function() {
let result;
while(true) {