blob: ffe58b2dd595d48ef02e9706df6306908ae14a66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package FixMyStreet::Auth::GoogleAuth;
use parent 'Auth::GoogleAuth';
use strict;
use warnings;
use Image::PNG::QRCode 'qrpng';
use URI;
# Overridden to return a data: URI of the image
sub qr_code {
my $self = shift;
my ( $secret32, $key_id, $issuer, $return_otpauth ) = @_;
# Make issuer a bit nicer to read
$issuer =~ s{https?://}{};
my $otpauth = $self->SUPER::qr_code($secret32, $key_id, $issuer, 1);
return $otpauth if $return_otpauth;
my $u = URI->new('data:');
$u->media_type('image/png');
$u->data(qrpng(text => $otpauth));
return $u;
}
1;
|