Commit a3866bc1 authored by Yadd's avatar Yadd

Login template in progress (#595)

parent 132de79b
...@@ -21,7 +21,7 @@ notification = 0 ...@@ -21,7 +21,7 @@ notification = 0
checkXSS = 0 checkXSS = 0
portalSkin = bootstrap portalSkin = bootstrap
staticPrefix = / staticPrefix = /
templateDir = __pwd__/lemonldap-ng-portal/example/skin templateDir = __pwd__/lemonldap-ng-portal/example/skins
[handler] [handler]
......
...@@ -85,15 +85,15 @@ sub display { ...@@ -85,15 +85,15 @@ sub display {
#utf8::decode($auth_user); #utf8::decode($auth_user);
%templateParams = ( %templateParams = (
AUTH_USER => $auth_user, AUTH_USER => $auth_user,
NEWWINDOW => $self->conf->{portalOpenLinkInNewWindow}, NEWWINDOW => $self->conf->{portalOpenLinkInNewWindow},
AUTH_ERROR => $req->errorString( $req->{menuError} ), AUTH_ERROR => $req->errorString( $req->{menuError} ),
AUTH_ERROR_TYPE => $req->error_type( $req->{menuError} ), AUTH_ERROR_TYPE => $req->error_type( $req->{menuError} ),
DISPLAY_TAB => $self->conf->{menuDisplayTab}, DISPLAY_TAB => $self->conf->{menuDisplayTab},
LOGOUT_URL => $self->conf->{portal} . "?logout=1", LOGOUT_URL => $self->conf->{portal} . "?logout=1",
DISPLAY_MODULES => $self->conf->{menuDisplayModules} || [], DISPLAY_MODULES => $self->conf->{menuDisplayModules} || [],
APPSLIST_ORDER => $req->{sessionInfo}->{'appsListOrder'}, APPSLIST_ORDER => $req->{sessionInfo}->{'appsListOrder'},
PING => $self->conf->{portalPingInterval}, PING => $self->conf->{portalPingInterval},
); );
} }
...@@ -109,7 +109,7 @@ sub display { ...@@ -109,7 +109,7 @@ sub display {
AUTH_ERROR_TYPE => $req->error_type, AUTH_ERROR_TYPE => $req->error_type,
NOTIFICATION => $notif, NOTIFICATION => $notif,
HIDDEN_INPUTS => $self->buildHiddenForm(), HIDDEN_INPUTS => $self->buildHiddenForm(),
AUTH_URL => $self->get_url, AUTH_URL => $req->{datas}->{_url},
CHOICE_PARAM => $self->conf->{authChoiceParam}, CHOICE_PARAM => $self->conf->{authChoiceParam},
CHOICE_VALUE => $req->{_authChoice}, CHOICE_VALUE => $req->{_authChoice},
); );
...@@ -122,7 +122,7 @@ sub display { ...@@ -122,7 +122,7 @@ sub display {
%templateParams = ( %templateParams = (
AUTH_ERROR => $req->error, AUTH_ERROR => $req->error,
AUTH_ERROR_TYPE => $req->error_type, AUTH_ERROR_TYPE => $req->error_type,
AUTH_URL => $self->get_url, AUTH_URL => $req->{datas}->{_url},
MSG => $req->info, MSG => $req->info,
HIDDEN_INPUTS => $self->buildHiddenForm(), HIDDEN_INPUTS => $self->buildHiddenForm(),
ACTIVE_TIMER => $self->conf->{activeTimer}, ACTIVE_TIMER => $self->conf->{activeTimer},
...@@ -181,7 +181,7 @@ sub display { ...@@ -181,7 +181,7 @@ sub display {
%templateParams = ( %templateParams = (
AUTH_ERROR => $req->error, AUTH_ERROR => $req->error,
AUTH_ERROR_TYPE => $req->error_type, AUTH_ERROR_TYPE => $req->error_type,
AUTH_URL => $self->get_url, AUTH_URL => $req->{datas}->{_url},
LOGIN => $login, LOGIN => $login,
CHECK_LOGINS => $self->conf->{portalCheckLogins}, CHECK_LOGINS => $self->conf->{portalCheckLogins},
ASK_LOGINS => $self->conf->{checkLogins}, ASK_LOGINS => $self->conf->{checkLogins},
......
...@@ -5,6 +5,7 @@ package Lemonldap::NG::Portal::Main::Request; ...@@ -5,6 +5,7 @@ package Lemonldap::NG::Portal::Main::Request;
use strict; use strict;
use Mouse; use Mouse;
use Lemonldap::NG::Portal::Main::Constants;
extends 'Lemonldap::NG::Common::PSGI::Request'; extends 'Lemonldap::NG::Common::PSGI::Request';
...@@ -49,6 +50,41 @@ sub wantJSON { ...@@ -49,6 +50,41 @@ sub wantJSON {
# Error type # Error type
sub 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 #TODO
} }
......
...@@ -92,7 +92,7 @@ sub authenticatedRequest { ...@@ -92,7 +92,7 @@ sub authenticatedRequest {
sub do { sub do {
my ( $self, $req, $steps ) = @_; my ( $self, $req, $steps ) = @_;
$req->steps($steps); $req->steps($steps);
my $err = $self->process($req); my $err = $req->error( $self->process($req) );
# TODO: updateStatus # TODO: updateStatus
if ( !$self->conf->{noAjaxHook} and $req->wantJSON ) { 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