diff --git a/twofactor/lang/en b/twofactor/lang/en index afc61ea2..d8c72124 100644 --- a/twofactor/lang/en +++ b/twofactor/lang/en @@ -36,3 +36,6 @@ twofactor_etotpmatch=Incorrect OTP code enable_title=Enabled Two-Factor Authentication enable_err=Enrollment failed + +qr_err=Failed to generate QR code +qr_estr=Missing QR code string! diff --git a/twofactor/qr.cgi b/twofactor/qr.cgi new file mode 100755 index 00000000..4b6c7a95 --- /dev/null +++ b/twofactor/qr.cgi @@ -0,0 +1,20 @@ +#!/usr/local/bin/perl +# Show a QR code based on parameters + +use strict; +use warnings; +no warnings 'redefine'; +no warnings 'uninitialized'; +$main::no_acl_check = 1; +require './twofactor-lib.pl'; + +our (%in, %text, %gconfig, %config); +&ReadParse(); +&error_setup($text{'qr_err'}); + +$in{'str'} || &error($text{'qr_estr'}); +my ($img, $mime) = &generate_qr_code($in{'str'}, $in{'size'}); +$img || &error($mime); + +&PrintHeader(undef, $mime); +print $img;