Commit a3866bc1 authored by Yadd's avatar Yadd

Login template in progress (#595)

parent 132de79b
......@@ -21,7 +21,7 @@ notification = 0
checkXSS = 0
portalSkin = bootstrap
staticPrefix = /
templateDir = __pwd__/lemonldap-ng-portal/example/skin
templateDir = __pwd__/lemonldap-ng-portal/example/skins
[handler]
......
......@@ -85,15 +85,15 @@ sub display {
#utf8::decode($auth_user);
%templateParams = (
AUTH_USER => $auth_user,
NEWWINDOW => $self->conf->{portalOpenLinkInNewWindow},
AUTH_ERROR => $req->errorString( $req->{menuError} ),
AUTH_ERROR_TYPE => $req->error_type( $req->{menuError} ),
DISPLAY_TAB => $self->conf->{menuDisplayTab},
LOGOUT_URL => $self->conf->{portal} . "?logout=1",
AUTH_USER => $auth_user,
NEWWINDOW => $self->conf->{portalOpenLinkInNewWindow},
AUTH_ERROR => $req->errorString( $req->{menuError} ),
AUTH_ERROR_TYPE => $req->error_type( $req->{menuError} ),
DISPLAY_TAB => $self->conf->{menuDisplayTab},
LOGOUT_URL => $self->conf->{portal} . "?logout=1",
DISPLAY_MODULES => $self->conf->{menuDisplayModules} || [],
APPSLIST_ORDER => $req->{sessionInfo}->{'appsListOrder'},
PING => $self->conf->{portalPingInterval},
APPSLIST_ORDER => $req->{sessionInfo}->{'appsListOrder'},
PING => $self->conf->{portalPingInterval},
);
}
......@@ -109,7 +109,7 @@ sub display {
AUTH_ERROR_TYPE => $req->error_type,
NOTIFICATION => $notif,
HIDDEN_INPUTS => $self->buildHiddenForm(),
AUTH_URL => $self->get_url,
AUTH_URL => $req->{datas}->{_url},
CHOICE_PARAM => $self->conf->{authChoiceParam},
CHOICE_VALUE => $req->{_authChoice},
);
......@@ -122,7 +122,7 @@ sub display {
%templateParams = (
AUTH_ERROR => $req->error,
AUTH_ERROR_TYPE => $req->error_type,
AUTH_URL => $self->get_url,
AUTH_URL => $req->{datas}->{_url},
MSG => $req->info,
HIDDEN_INPUTS => $self->buildHiddenForm(),
ACTIVE_TIMER => $self->conf->{activeTimer},
......@@ -181,7 +181,7 @@ sub display {
%templateParams = (
AUTH_ERROR => $req->error,
AUTH_ERROR_TYPE => $req->error_type,
AUTH_URL => $self->get_url,
AUTH_URL => $req->{datas}->{_url},
LOGIN => $login,
CHECK_LOGINS => $self->conf->{portalCheckLogins},
ASK_LOGINS => $self->conf->{checkLogins},
......
......@@ -5,6 +5,7 @@ package Lemonldap::NG::Portal::Main::Request;
use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants;
extends 'Lemonldap::NG::Common::PSGI::Request';
......@@ -49,6 +50,41 @@ sub wantJSON {
# Error type
sub error_type {
my $req = shift;
my $code = shift || $req->error;
# Positive errors
return "positive"
if (
scalar(
grep { /^$code$/ } (
PE_REDIRECT, PE_DONE,
PE_OK, PE_PASSWORD_OK,
PE_MAILOK, PE_LOGOUT_OK,
PE_MAILFIRSTACCESS, PE_PASSWORDFIRSTACCESS,
PE_MAILCONFIRMOK, PE_REGISTERFIRSTACCESS,
)
)
);
# Warning errors
return "warning"
if (
scalar(
grep { /^$code$/ } (
PE_INFO, PE_SESSIONEXPIRED,
PE_FORMEMPTY, PE_FIRSTACCESS,
PE_PP_GRACE, PE_PP_EXP_WARNING,
PE_NOTIFICATION, PE_BADURL,
PE_CONFIRM, PE_MAILFORMEMPTY,
PE_MAILCONFIRMATION_ALREADY_SENT, PE_PASSWORDFORMEMPTY,
PE_CAPTCHAEMPTY, PE_REGISTERFORMEMPTY,
)
)
);
# Negative errors (default)
return "negative";
#TODO
}
......
......@@ -92,7 +92,7 @@ sub authenticatedRequest {
sub do {
my ( $self, $req, $steps ) = @_;
$req->steps($steps);
my $err = $self->process($req);
my $err = $req->error( $self->process($req) );
# TODO: updateStatus
if ( !$self->conf->{noAjaxHook} and $req->wantJSON ) {
......
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