Commit 095b1d25 authored by Christophe Maudoux's avatar Christophe Maudoux

Append parameter test & error msg

parent 2672fa00
......@@ -268,13 +268,16 @@ sub run {
# Delete TOTP
elsif ( $action eq 'delete' ) {
my $epoch = $req->param('epoch');
# Check if unregistration is allowed
unless ( $self->conf->{totp2fUserCanRemoveKey} ) {
return $self->p->sendError( $req, 'notAuthorized', 400 );
}
my $epoch = $req->param('epoch')
or return $self->p->sendError( $req, '"epoch" parameter is missing',
400 );
# Read existing 2FDevices
$self->logger->debug("Loading 2F Devices ...");
my $_2fDevices;
......
......@@ -254,7 +254,9 @@ sub run {
return $self->p->sendError( $req, 'notAuthorized', 200 );
}
my $epoch = $req->param('epoch');
my $epoch = $req->param('epoch')
or return $self->p->sendError( $req, '"epoch" parameter is missing',
400 );
# Read existing 2FDevices
$self->logger->debug("Looking for 2F Devices ...");
......
......@@ -137,13 +137,16 @@ sub run {
}
elsif ( $action eq 'delete' ) {
my $epoch = $req->param('epoch');
# Check if unregistration is allowed
unless ( $self->conf->{yubikey2fUserCanRemoveKey} ) {
return $self->p->sendError( $req, 'notAuthorized', 400 );
}
my $epoch = $req->param('epoch')
or return $self->p->sendError( $req, '"epoch" parameter is missing',
400 );
# Read existing 2FDevices
$self->logger->debug("Looking for 2F Devices ...");
my $_2fDevices;
......
Markdown is supported
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