mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
2FA: Registraion of U2F devices
This commit is contained in:
22
src/static/pretixcontrol/js/ui/u2f.js
Normal file
22
src/static/pretixcontrol/js/ui/u2f.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/*global $,u2f */
|
||||
$(function () {
|
||||
if ($("#u2f-enroll").length) {
|
||||
var request = JSON.parse($.trim($("#u2f-enroll").html()));
|
||||
setTimeout(function () {
|
||||
var appId = request.registerRequests[0].appId;
|
||||
$('#promptModal').modal('show');
|
||||
console.log(appId, request.registerRequests);
|
||||
u2f.register(appId, request.registerRequests, [], function (data) {
|
||||
console.log("callback", data);
|
||||
if (data.errorCode) {
|
||||
$("#u2f-error").removeClass("sr-only");
|
||||
$("#u2f-progress").remove();
|
||||
} else {
|
||||
console.log("Register callback", data);
|
||||
$('#u2f-response').val(JSON.stringify(data));
|
||||
$('#u2f-form').submit();
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user