Session upgrade skeleton (#1204)

environments/ppa-mbqj77/deployments/1
Xavier Guimard 8 years ago
parent 7b06532ee6
commit 050cf20c72
  1. 1
      lemonldap-ng-portal/MANIFEST
  2. 46
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/Upgrade.pm

@ -96,6 +96,7 @@ lib/Lemonldap/NG/Portal/Plugins/SOAPServer.pm
lib/Lemonldap/NG/Portal/Plugins/Status.pm
lib/Lemonldap/NG/Portal/Plugins/StayConnected.pm
lib/Lemonldap/NG/Portal/Plugins/U2F.pm
lib/Lemonldap/NG/Portal/Plugins/Upgrade.pm
lib/Lemonldap/NG/Portal/Register/AD.pm
lib/Lemonldap/NG/Portal/Register/Custom.pm
lib/Lemonldap/NG/Portal/Register/Demo.pm

@ -0,0 +1,46 @@
package Lemonldap::NG::Portal::Plugins::Upgrade;
use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(PE_CONFIRM PE_OK);
our $VERSION = '2.0.0';
extends 'Lemonldap::NG::Portal::Main::Plugin';
# INITIALIZATION
sub init {
my ($self) = @_;
$self->addAuthRoute(upgradesession => 'ask', ['GET']);
$self->addAuthRoute(upgradesession => 'confirm', ['POST']);
}
# RUNNING METHOD
sub ask {
my ( $self, $req ) = @_;
if($req->param('upgrading') ) {
# verify token
return $self->confirm($req);
}
# Display form
}
sub confirm {
my ( $self, $req ) = @_;
my $ok;
if($req->param('upgrading') ) {
# verify token and set $ok to 1
}
if ( $ok or $req->param('confirm') == 1 ) {
$self->p->setHiddenFormValue(); # Insert token
return $self->p->login($req);
}
else {
# Go to portal
}
}
1;
Loading…
Cancel
Save