Commit 0634fcaf authored by Christophe Maudoux's avatar Christophe Maudoux 🐛
Browse files

Typos & tidy

parent 79eaa9cb
Pipeline #14396 passed with stages
in 16 minutes and 54 seconds
......@@ -15,15 +15,15 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_SENDRESPONSE
);
our $VERSION = '2.0.10';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::SecondFactor';
# INITIALIZATION
has prefix => ( is => 'ro', default => 'yubikey' );
has logo => ( is => 'rw', default => 'yubikey.png' );
has yubi => ( is => 'rw' );
has logo => ( is => 'rw', default => 'yubikey.png' );
has yubi => ( is => 'rw' );
sub init {
my ($self) = @_;
......@@ -77,7 +77,7 @@ sub init {
$self->conf->{yubikey2fUrl}
? ( url => $self->conf->{yubikey2fUrl} )
: ()
),
)
}
)
);
......@@ -86,7 +86,7 @@ sub init {
sub _findYubikey {
my ( $self, $req, $sessionInfo ) = @_;
my ( $yubikey, $_2fDevices, $code );
my ( $yubikey, $_2fDevices );
# First, lookup from session attribute
if ( $self->conf->{yubikey2fFromSessionAttribute} ) {
......@@ -96,7 +96,7 @@ sub _findYubikey {
# If we didn't find a key, lookup psession
if ( !$yubikey and $sessionInfo->{_2fDevices} ) {
$self->logger->debug("Loading 2F Devices ...");
$self->logger->debug("Loading 2F Devices...");
# Read existing 2FDevices
$_2fDevices = eval {
......@@ -107,13 +107,16 @@ sub _findYubikey {
return PE_ERROR;
}
$self->logger->debug("2F Device(s) found");
$self->logger->debug("Reading Yubikey ...");
if ( $code = $req->param('code') ) {
$yubikey = $_->{_yubikey}
foreach grep { ($_->{type} eq 'UBK') and ( $_->{_yubikey} eq
substr( $code, 0, $self->conf->{yubikey2fPublicIDSize} ) ) } @$_2fDevices;
} else {
$self->logger->debug("Reading Yubikey...");
if ( my $code = $req->param('code') ) {
$yubikey = $_->{_yubikey} foreach grep {
( $_->{type} eq 'UBK' )
and ( $_->{_yubikey} eq
substr( $code, 0, $self->conf->{yubikey2fPublicIDSize} ) )
} @$_2fDevices;
}
else {
$yubikey = $_->{_yubikey}
foreach grep { $_->{type} eq 'UBK' } @$_2fDevices;
}
......@@ -127,7 +130,7 @@ sub run {
my ( $self, $req, $token, $_2fDevices ) = @_;
my $checkLogins = $req->param('checkLogins');
$self->logger->debug("Yubikey; checkLogins set") if ($checkLogins);
$self->logger->debug("Yubikey; checkLogins set") if $checkLogins;
my $stayconnected = $req->param('stayconnected');
$self->logger->debug("Yubikey: stayconnected set") if $stayconnected;
......@@ -147,13 +150,13 @@ sub run {
$req,
'ext2fcheck',
params => {
MAIN_LOGO => $self->conf->{portalMainLogo},
SKIN => $self->p->getSkin($req),
TOKEN => $token,
TARGET => '/yubikey2fcheck?skin=' . $self->p->getSkin($req),
INPUTLOGO => 'yubikey.png',
LEGEND => 'clickOnYubikey',
CHECKLOGINS => $checkLogins,
MAIN_LOGO => $self->conf->{portalMainLogo},
SKIN => $self->p->getSkin($req),
TOKEN => $token,
TARGET => '/yubikey2fcheck?skin=' . $self->p->getSkin($req),
INPUTLOGO => 'yubikey.png',
LEGEND => 'clickOnYubikey',
CHECKLOGINS => $checkLogins,
STAYCONNECTED => $stayconnected
}
);
......@@ -177,7 +180,7 @@ sub verify {
if (
index( $yubikey,
substr( $code, 0, $self->conf->{yubikey2fPublicIDSize} ) ) == -1
)
)
{
$self->userLogger->warn('Yubikey not registered');
return PE_BADOTP;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment