Commit 7b5650d5 authored by Xavier Guimard's avatar Xavier Guimard

2F registration menu (#1148 #1359 #1391)

parent 3dcc4af9
......@@ -231,13 +231,26 @@ sub displayRegister {
$self->logger->debug(
'Looking if ' . $m->{m}->prefix . '2F register is available' );
if ( $m->{r}->( $req, $req->userData ) ) {
push @am, '/2fregisters/' . $m->{m}->prefix;
push @am,
{
CODE => $m->{m}->prefix,
URL => '/2fregisters/' . $m->{m}->prefix,
LOGO => $m->{m}->logo,
};
}
}
if ( @am == 1 ) {
return [ 302, [ Location => $self->conf->{portal} . $am[0] ], [] ];
return [ 302, [ Location => $self->conf->{portal} . $am[0]->{url} ],
[] ];
}
return $self->p->sendHtml( $req, '2fregisters' );
return $self->p->sendHtml(
$req,
'2fregisters',
params => {
SKIN => $self->conf->{portalSkin},
MODULES => \@am,
}
);
}
# Check rule and display
......
......@@ -14,6 +14,8 @@ has prefix => ( is => 'rw', default => 'totp' );
has template => ( is => 'ro', default => 'totpregister' );
has logo => ( is => 'rw', default => 'totp.png' );
has ott => (
is => 'rw',
lazy => 1,
......
......@@ -14,6 +14,8 @@ has prefix => ( is => 'rw', default => 'u' );
has template => ( is => 'ro', default => 'u2fregister' );
has logo => ( is => 'rw', default => 'u2f.png' );
sub init {
my ($self) = @_;
return 0 unless $self->SUPER::init;
......
<TMPL_INCLUDE NAME="header.tpl">
<div class="container">
<div class="message message-positive alert" trspan="choose2f"></div>
<div class="buttons">
<TMPL_LOOP NAME="MODULES">
<a href="<TMPL_VAR NAME="URL">">
<img src="<TMPL_VAR NAME="STATIC_PREFIX"><TMPL_VAR NAME="SKIN">/<TMPL_VAR NAME="LOGO">" />
</a>
</TMPL_LOOP>
</form>
</div>
</div>
<div class="buttons">
<a href="<TMPL_VAR NAME="PORTAL_URL">" class="btn btn-primary" role="button">
<span class="glyphicon glyphicon-home"></span>&nbsp;
<span trspan="goToPortal">Go to portal</span>
</a>
</div>
<TMPL_INCLUDE NAME="footer.tpl">
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