diff --git a/static/moderator.js b/static/moderator.js index 2444947ffde1b90cab90652194cb4c6ccb2047ea..dec55f9f690ebb1d4d7858d2a8f222e1cab98342 100644 --- a/static/moderator.js +++ b/static/moderator.js @@ -191,8 +191,11 @@ var moderator = { html += '<option value="none">Kein Zugriff</option>'; html += '</select>'; html += '<input class="col-xs-12 passwordinput authuser" type="text" placeholder="Benutzername">'; - html += '<input class="col-xs-12 passwordinput authpassword" type="text" placeholder="Passwort">'; + html += '<input class="col-xs-10 passwordinput authpassword" type="text" placeholder="Passwort">' + html += '<button class="col-xs-2 passwordinput authpgen" type="button" onclick="$(\'.authpassword\',this.parentNode).val(moderator.permissioneditor.randompw());"><span class="fa fa-plus" aria-hidden="true"></span></button>' + html += '<input class="col-xs-12 authl2p" type="text" placeholder="Lernraum" style="display: none;">'; + html += '<button class="col-xs-6" onclick="moderator.permissioneditor.addbtnclick(this)">Add</button>'; //html += '<button class="col-xs-4" onclick="moderator.permissionedior.updatebtnclick(this)">Update</button>'; html += '<button class="col-xs-6" onclick="moderator.permissioneditor.delbtnclick(this)">Delete</button>'; @@ -248,6 +251,15 @@ var moderator = { $(".authl2p",element.parentElement).hide(); break; } + }, + randompw: function () {; + var array = new Uint8Array(10); + window.crypto.getRandomValues(array); + var result = ''; + for (var i = 0; i< array.length; i++) { + result += String.fromCharCode(48+ (array[i]/255.0)*74); + } + return result; } }, plots: {