Improve code (#2163)
This commit is contained in:
parent
c61ae6be59
commit
9d6197232f
|
@ -9,7 +9,6 @@ use Lemonldap::NG::Portal::Main::Constants qw(
|
|||
PE_ERROR
|
||||
PE_TOKENEXPIRED
|
||||
PE_NOTOKEN
|
||||
PE_REDIRECT
|
||||
);
|
||||
|
||||
our $VERSION = '2.0.8';
|
||||
|
@ -56,12 +55,12 @@ sub init {
|
|||
|
||||
sub run {
|
||||
my ( $self, $req ) = @_;
|
||||
my ( $linkedSessionId, $token, $html ) = ( '', '', '' );
|
||||
my $deleted = [];
|
||||
my $otherSessions = [];
|
||||
my @otherSessionsId = ();
|
||||
my $linkedSessionId = '';
|
||||
my $token = '';
|
||||
my $moduleOptions = $self->conf->{globalStorageOptions} || {};
|
||||
|
||||
my $moduleOptions = $self->conf->{globalStorageOptions} || {};
|
||||
$moduleOptions->{backend} = $self->conf->{globalStorage};
|
||||
|
||||
my $sessions = $self->module->searchOn(
|
||||
|
@ -120,14 +119,15 @@ sub run {
|
|||
}
|
||||
}
|
||||
}
|
||||
$req->info(
|
||||
$self->p->mkSessionArray( $req, $deleted, 'sessionsDeleted', 1 ) )
|
||||
|
||||
$html = $self->p->mkSessionArray( $req, $deleted, 'sessionsDeleted', 1 )
|
||||
if ( $self->conf->{notifyDeleted} and @$deleted );
|
||||
$req->info(
|
||||
$self->p->mkSessionArray( $req, $otherSessions, 'otherSessions', 1 )
|
||||
. $self->_mkRemoveOtherLink( $req, $token ) )
|
||||
$html .=
|
||||
$self->p->mkSessionArray( $req, $otherSessions, 'otherSessions', 1 )
|
||||
. $self->_mkRemoveOtherLink($req, $token)
|
||||
if ( $self->conf->{notifyOther} and @$otherSessions );
|
||||
|
||||
$req->info($html);
|
||||
return PE_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -290,10 +290,11 @@ $(window).on 'load', () ->
|
|||
console.log 'method=', method
|
||||
|
||||
hiddenParams = ""
|
||||
$("#form input[type=hidden]").each (index) ->
|
||||
console.log 'Parse hidden values'
|
||||
console.log ' ->', $(this).attr("name"), $(this).val()
|
||||
hiddenParams += "&" + $(this).attr("name") + "=" + $(this).val()
|
||||
if $("#form input[type=hidden]")
|
||||
console.log 'Parse hidden values'
|
||||
$("#form input[type=hidden]").each (index) ->
|
||||
console.log ' ->', $(this).attr("name"), $(this).val()
|
||||
hiddenParams += "&" + $(this).attr("name") + "=" + $(this).val()
|
||||
|
||||
back_url = ""
|
||||
if action
|
||||
|
@ -305,7 +306,8 @@ $(window).on 'load', () ->
|
|||
back_url += hiddenParams
|
||||
hiddenParams = ""
|
||||
|
||||
link = $("p.removeOther a").attr("href") + "&method=" + method + hiddenParams + "&url=" + btoa(back_url)
|
||||
link = $("p.removeOther a").attr("href") + "&method=" + method + hiddenParams
|
||||
link += "&url=" + btoa(back_url) if back_url
|
||||
$("p.removeOther a").attr "href", link
|
||||
|
||||
# Language detection. Priority order:
|
||||
|
|
|
@ -276,11 +276,13 @@ LemonLDAP::NG Portal jQuery scripts
|
|||
method = $("#form").attr("method");
|
||||
console.log('method=', method);
|
||||
hiddenParams = "";
|
||||
$("#form input[type=hidden]").each(function(index) {
|
||||
if ($("#form input[type=hidden]")) {
|
||||
console.log('Parse hidden values');
|
||||
console.log(' ->', $(this).attr("name"), $(this).val());
|
||||
return hiddenParams += "&" + $(this).attr("name") + "=" + $(this).val();
|
||||
});
|
||||
$("#form input[type=hidden]").each(function(index) {
|
||||
console.log(' ->', $(this).attr("name"), $(this).val());
|
||||
return hiddenParams += "&" + $(this).attr("name") + "=" + $(this).val();
|
||||
});
|
||||
}
|
||||
back_url = "";
|
||||
if (action) {
|
||||
console.log('action=', action);
|
||||
|
@ -292,7 +294,10 @@ LemonLDAP::NG Portal jQuery scripts
|
|||
back_url += hiddenParams;
|
||||
hiddenParams = "";
|
||||
}
|
||||
link = $("p.removeOther a").attr("href") + "&method=" + method + hiddenParams + "&url=" + btoa(back_url);
|
||||
link = $("p.removeOther a").attr("href") + "&method=" + method + hiddenParams;
|
||||
if (back_url) {
|
||||
link += "&url=" + btoa(back_url);
|
||||
}
|
||||
$("p.removeOther a").attr("href", link);
|
||||
}
|
||||
queryString = window.location.search;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user