Commit 72a076d9 authored by Xavier Guimard's avatar Xavier Guimard

Adapt Display.pm

parent e25d286b
...@@ -184,7 +184,7 @@ sub sendHtml { ...@@ -184,7 +184,7 @@ sub sendHtml {
STATIC_PREFIX => $sp, STATIC_PREFIX => $sp,
AVAILABLE_LANGUAGES => $self->languages, AVAILABLE_LANGUAGES => $self->languages,
PORTAL => $self->portal, PORTAL => $self->portal,
( $self->can('tplParams') ? %{ $self->tplParams } : () ), ( $args{params} ? %{ $args{params} } : () ),
); );
}; };
if ($@) { if ($@) {
......
...@@ -6,6 +6,13 @@ ...@@ -6,6 +6,13 @@
</div> </div>
</div> </div>
<!-- Constants -->
<script type="text/JavaScript">
var staticPrefix = '<TMPL_VAR NAME="STATIC_PREFIX">'.replace(/\/*$/,'/');
var scriptname='<TMPL_VAR NAME="SCRIPT_NAME">'.replace(/^$/,'.').replace(/\/*$/,'/');
var availableLanguages='<TMPL_VAR NAME="AVAILABLE_LANGUAGES">'.split(/[,;] */);
var portal ='<TMPL_VAR NAME="PORTAL">';
</script>
</body> </body>
</html> </html>
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
</div> </div>
<!-- Constants -->
<script type="text/JavaScript">
var staticPrefix = '<TMPL_VAR NAME="STATIC_PREFIX">'.replace(/\/*$/,'/');
var scriptname='<TMPL_VAR NAME="SCRIPT_NAME">'.replace(/^$/,'.').replace(/\/*$/,'/');
var availableLanguages='<TMPL_VAR NAME="AVAILABLE_LANGUAGES">'.split(/[,;] */);
var portal ='<TMPL_VAR NAME="PORTAL">';
</script>
</body> </body>
</html> </html>
<div id="footer"><TMPL_INCLUDE NAME="customfooter.tpl"></div> <div id="footer"><TMPL_INCLUDE NAME="customfooter.tpl"></div>
</div><!-- end div "page" --> </div><!-- end div "page" -->
<!-- Constants -->
<script type="text/JavaScript">
var staticPrefix = '<TMPL_VAR NAME="STATIC_PREFIX">'.replace(/\/*$/,'/');
var scriptname='<TMPL_VAR NAME="SCRIPT_NAME">'.replace(/^$/,'.').replace(/\/*$/,'/');
var availableLanguages='<TMPL_VAR NAME="AVAILABLE_LANGUAGES">'.split(/[,;] */);
var portal ='<TMPL_VAR NAME="PORTAL">';
</script>
</body> </body>
</html> </html>
package Lemonldap::NG::Portal::Main::Auth; package Lemonldap::NG::Portal::Auth::Base;
use strict; use strict;
use Mouse; use Mouse;
......
...@@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Main::Constants; ...@@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Main::Constants;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
extends 'Lemonldap::NG::Portal::Main::Auth'; extends 'Lemonldap::NG::Portal::Auth::Base';
## @apmethod int authInit() ## @apmethod int authInit()
# Does nothing. # Does nothing.
......
...@@ -3,11 +3,17 @@ package Lemonldap::NG::Portal::Main; ...@@ -3,11 +3,17 @@ package Lemonldap::NG::Portal::Main;
use strict; use strict;
use Mouse; use Mouse;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Portal::Main::Constants;
use Lemonldap::NG::Portal::Main::Request;
use Lemonldap::NG::Portal::Main::Plugins;
use Lemonldap::NG::Portal::Main::Init;
use Lemonldap::NG::Portal::Main::Run;
use Lemonldap::NG::Portal::Main::Process;
use Lemonldap::NG::Portal::Main::Display;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
extends( extends 'Lemonldap::NG::Handler::PSGI::Try';
'Lemonldap::NG::Portal::Main::Run',
'Lemonldap::NG::Portal::Main::Init',
);
1; 1;
This diff is collapsed.
...@@ -8,18 +8,14 @@ ...@@ -8,18 +8,14 @@
# of lemonldap-ng.ini) and underlying handler configuration # of lemonldap-ng.ini) and underlying handler configuration
package Lemonldap::NG::Portal::Main::Init; package Lemonldap::NG::Portal::Main::Init;
our $VERSION = '2.0.0';
package Lemonldap::NG::Portal::Main;
use strict; use strict;
use Mouse; use Mouse;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Portal::Main::Constants;
use Lemonldap::NG::Portal::Main::Plugins;
use Regexp::Assemble; use Regexp::Assemble;
our $VERSION = '2.0.0';
extends 'Lemonldap::NG::Handler::PSGI::Try',
'Lemonldap::NG::Portal::Main::Plugins';
# Configuration storage # Configuration storage
has localConfig => ( is => 'rw', default => sub { {} } ); has localConfig => ( is => 'rw', default => sub { {} } );
has conf => ( is => 'rw', default => sub { {} } ); has conf => ( is => 'rw', default => sub { {} } );
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
# into "plugins" list in lemonldap-ng.ini, section "portal" # into "plugins" list in lemonldap-ng.ini, section "portal"
package Lemonldap::NG::Portal::Main::Plugins; package Lemonldap::NG::Portal::Main::Plugins;
use strict;
use Mouse;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
package Lemonldap::NG::Portal::Main;
use strict;
##@method list enabledPlugins ##@method list enabledPlugins
# #
#@return list of enabled plugins #@return list of enabled plugins
......
package Lemonldap::NG::Portal::Main::Process; package Lemonldap::NG::Portal::Main::Process;
our $VERSION = '2.0.0';
package Lemonldap::NG::Portal::Main;
use strict; use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants;
use Lemonldap::NG::Portal::Main::Request;
use MIME::Base64; use MIME::Base64;
use POSIX qw(strftime); use POSIX qw(strftime);
our $VERSION = '2.0.0';
# Main method # Main method
# ----------- # -----------
# Launch all methods declared in request "steps" array. Methods can be # Launch all methods declared in request "steps" array. Methods can be
......
...@@ -31,8 +31,35 @@ has mustRedirect => ( is => 'rw' ); ...@@ -31,8 +31,35 @@ has mustRedirect => ( is => 'rw' );
# Boolean to indicate that url isn't Base64 encoded # Boolean to indicate that url isn't Base64 encoded
has urlNotBase64 => ( is => 'rw' ); has urlNotBase64 => ( is => 'rw' );
# Info to display at login
has info => ( is => 'rw' );
# Menu error
has menuError => ( is => 'rw' );
# Notification
has notification => ( is => 'rw' );
has _authChoice => ( is => 'rw' );
has _openidPortal => ( is => 'rw' );
sub wantJSON { sub wantJSON {
return $_[0]->accept =~ m#(?:application|text)/json# ? 1 : 0; return $_[0]->accept =~ m#(?:application|text)/json# ? 1 : 0;
} }
# Error type
sub error_type {
#TODO
}
sub errorString {
#TODO
}
sub loginInfo {
}
# TODO: oldpassword
1; 1;
...@@ -9,14 +9,11 @@ ...@@ -9,14 +9,11 @@
# #
package Lemonldap::NG::Portal::Main::Run; package Lemonldap::NG::Portal::Main::Run;
use strict; our $VERSION = '2.0.0';
use Mouse;
use Lemonldap::NG::Portal::Main::Constants;
use Lemonldap::NG::Portal::Main::Request;
extends 'Lemonldap::NG::Portal::Main::Process'; package Lemonldap::NG::Portal::Main;
our $VERSION = '2.0.0'; use strict;
# List constants # List constants
sub authProcess { qw(extractFormInfo getUser authenticate) } sub authProcess { qw(extractFormInfo getUser authenticate) }
...@@ -116,11 +113,7 @@ sub do { ...@@ -116,11 +113,7 @@ sub do {
} }
else { else {
if ($err) { if ($err) {
return $self->sendHtml( return $self->display($req);
$req,
$req->template || 'login',
headers => $req->respHeaders
);
} }
else { else {
return $self->autoRedirect($req); return $self->autoRedirect($req);
...@@ -170,7 +163,7 @@ sub autoRedirect { ...@@ -170,7 +163,7 @@ sub autoRedirect {
]; ];
} }
else { else {
return $self->sendHtml( $req, $req->template || 'menu' ); return $self->display($req);
} }
} }
......
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title trspan="authenticationPortal">Authentication portal</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="cache-control" content="no-cache" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- //if:usedebianlibs
<link rel="stylesheet" type="text/css" href="/javascript/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/javascript/bootstrap/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/portal.min.css" />
//elsif:useexternallibs
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/portal.min.css" />
//elsif:cssminified
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/portal.min.css" />
//else -->
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/portal.css" />
<!-- //endif -->
<link rel="shortcut icon" type="image/vnd.microsoft.icon" sizes="16x16 32x32 48x48 64x64 128x128" href="<TMPL_VAR NAME="STATIC_PREFIX">logos/favicon.ico" />
<link rel="icon" type="image/vnd.microsoft.icon" sizes="16x16 32x32 48x48 64x64 128x128" href="<TMPL_VAR NAME="STATIC_PREFIX">logos/favicon.ico" />
<TMPL_INCLUDE NAME="header.tpl">
</head>
<body>
<div id="logincontent" class="container">
<TMPL_IF NAME="AUTH_ERROR">
<div class="message message-<TMPL_VAR NAME="AUTH_ERROR_TYPE"> alert"><TMPL_VAR NAME="AUTH_ERROR"></div>
</TMPL_IF>
<div class="panel panel-default">
<form action="#" method="post" class="login" role="form">
<!-- Hidden fields -->
<TMPL_VAR NAME="HIDDEN_INPUTS">
<input type="hidden" name="url" value="<TMPL_VAR NAME="AUTH_URL">" />
<input type="hidden" name="timezone" />
<TMPL_INCLUDE NAME="standardform.tpl">
</form>
</div>
</div>
<TMPL_INCLUDE NAME="scripts.tpl">
<TMPL_INCLUDE NAME="footer.tpl">
<!-- Constants -->
<script type="text/JavaScript">
var staticPrefix = '<TMPL_VAR NAME="STATIC_PREFIX">'.replace(/\/*$/,'/');
var formPrefix = staticPrefix+'forms/';
var scriptname='<TMPL_VAR NAME="SCRIPT_NAME">'.replace(/^$/,'.').replace(/\/*$/,'/');
var confPrefix=scriptname+'confs/';
var availableLanguages='<TMPL_VAR NAME="AVAILABLE_LANGUAGES">'.split(/[,;] */);
var links=<TMPL_VAR NAME="LINKS">;
var menulinks=<TMPL_VAR NAME="MENULINKS">;
var portal ='<TMPL_VAR NAME="PORTAL">';
</script>
<!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/javascript/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/portal.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/portal.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">bwr/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">bwr/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/portal.min.js"></script>
//else -->
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">bwr/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">bwr/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/portal.js"></script>
<!-- //endif -->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
...@@ -20,6 +20,7 @@ sub init { ...@@ -20,6 +20,7 @@ sub init {
$ini->{logLevel} ||= 'error'; $ini->{logLevel} ||= 'error';
$ini->{cookieName} ||= 'lemonldap'; $ini->{cookieName} ||= 'lemonldap';
$ini->{templateDir} ||= 'site/templates'; $ini->{templateDir} ||= 'site/templates';
$ini->{staticPrefix} ||= '/index.fcgi';
$ini->{securedCookie} //= 0; $ini->{securedCookie} //= 0;
$ini->{https} //= 0; $ini->{https} //= 0;
ok( $client = My::Cli->new(), 'Portal app' ); ok( $client = My::Cli->new(), 'Portal app' );
......
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