Commit 7d98447f authored by Yadd's avatar Yadd
Browse files

PE_CONFIRM target

parent 271c4767
......@@ -64,6 +64,7 @@ example/skins/common/vcard_edit.png
example/skins/common/vcss-blue.gif
example/skins/common/warning.png
example/skins/common/warning_triangle.png
example/skins/pastel/confirm.tpl
example/skins/pastel/error.tpl
example/skins/pastel/footer.tpl
example/skins/pastel/hatch.gif
......
......@@ -150,7 +150,10 @@ my $portal = Lemonldap::NG::Portal::SharedConf->new(
# Get skin value
my $skin = $portal->{portalSkin};
# 1. Case well authenticated
if ( $portal->process() ) {
# Case there is a message to display
if ( my $info = $portal->info() ) {
my $template = HTML::Template->new(
filename => "$skin_dir/$skin/info.tpl",
......@@ -236,6 +239,26 @@ elsif ( my $notif = $portal->notification ) {
print $portal->header('text/html; charset=utf-8');
print $template->output;
}
elsif ( $portal->{error} == PE_CONFIRM ) {
my $msg = $portal->info();
# HTML::Template object creation
my $template = HTML::Template->new(
filename => "$skin_dir/$skin/confirm.tpl",
die_on_bad_params => 0,
cache => 0,
filter => sub { $portal->translate_template(@_) }
);
$template->param( AUTH_ERROR => $portal->error );
$template->param( AUTH_ERROR_TYPE => $portal->error_type );
$template->param( AUTH_URL => $portal->get_url );
$template->param( MSG => $msg );
$template->param( SKIN => $skin );
print $portal->header('text/html; charset=utf-8');
print $template->output;
}
else {
# HTML::Template object creation
......
<TMPL_INCLUDE NAME="header.tpl">
<div class="message <TMPL_VAR NAME="AUTH_ERROR_TYPE">"><ul><li>
<lang en="Confirmation" fr="Confirmation"/>
</li></ul></div>
<div class="loginlogo"></div>
<form id="form" action="<TMPL_VAR NAME="URL">" method="post" class="login">
<p><input type="hidden" name="url" value="<TMPL_VAR NAME="AUTH_URL">" /></p>
<input type="hidden" id="confirm" name="confirm" value="1" />
<h3><lang en="Confirmation" fr="Confirmation"/>&nbsp;:</h3>
<TMPL_VAR NAME="MSG">
<p id="timer"><lang en="Automaticaly accept in 5 seconds" fr="Acceptation automatique dans dans 5 secondes"/></p>
<div class="buttons">
<button type="submit" class="positive">
<img src="skins/common/accept.png" alt="" />
<lang en="Accept" fr="Accepter" />
</button>
<button type="submit" class="negative" onclick="$('#confirm').attr('value','-1');">
<img src="skins/common/cancel.png" alt="" />
<lang en="Refuse" fr="Refuser" />
</button>
</div>
</td></tr>
</table>
</form>
<script>
var i=5;
function go() {
$("#form").submit();
}
function timer() {
var h=$('#timer').html();
i--;
h=h.replace(/\d+/,i);
$('#timer').html(h);
window.setTimeout('timer()',1000);
}
$(document).ready(function(){
window.setTimeout('go()',5000);
window.setTimeout('timer()',1000);
});
</script>
<TMPL_INCLUDE NAME="footer.tpl">
......@@ -85,6 +85,7 @@ use constant {
PE_BADOLDPASSWORD => 39,
PE_MALFORMEDUSER => 40,
PE_SESSIONNOTGRANTED => 41,
PE_CONFIRM => 42,
};
# EXPORTER PARAMETERS
......@@ -98,6 +99,7 @@ our @EXPORT = qw( PE_INFO PE_CONFIRM PE_REDIRECT PE_DONE PE_OK PE_SESSIONEXPIRED
PE_PP_PASSWORD_TOO_YOUNG PE_PP_PASSWORD_IN_HISTORY PE_PP_GRACE
PE_PP_EXP_WARNING PE_PASSWORD_MISMATCH PE_PASSWORD_OK PE_NOTIFICATION
PE_BADURL PE_NOSCHEME PE_BADOLDPASSWORD PE_MALFORMEDUSER PE_SESSIONNOTGRANTED
PE_CONFIRM
);
our %EXPORT_TAGS = ( 'all' => [ @EXPORT, 'import' ], );
......@@ -345,6 +347,7 @@ sub error_type {
PE_FORMEMPTY, PE_FIRSTACCESS,
PE_PP_GRACE, PE_PP_EXP_WARNING,
PE_NOTIFICATION, PE_BADURL,
PE_CONFIRM,
)
)
);
......
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