diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/FavApps.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/FavApps.pm
index 03c36a4ec..3ff0ed26d 100644
--- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/FavApps.pm
+++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/FavApps.pm
@@ -28,30 +28,37 @@ sub init {
# RUNNING METHOD
sub register {
- my ( $self, $req, $apps ) = @_;
- my $user = $req->sessionInfo->{ $self->conf->{whatToTrace} };
+ my ( $self, $req ) = @_;
+ my $user = $req->userData->{ $self->conf->{whatToTrace} };
+ my $app = $req->param('app');
+ my $logo = $req->param('logo') || '';
+ my $title = $req->param('title') || '';
+
+ # TODO -> test app
+ $self->logger->debug("Favorite application received : $app");
# Read existing favorite Apps
- $self->logger->debug("Looking for favorite Apps...");
- my $_favapps;
- if ( $req->sessionInfo->{_favApps} ) {
- $_favapps = eval {
- from_json( $req->sessionInfo->{_favapps}, { allow_nonref => 1 } );
+ $self->logger->debug("Looking for $user favorite Apps...");
+ my $_favApps;
+ #$self->logger->debug("*****" . Data::Dumper::Dumper($req));
+ if ( $req->userData->{_favApps} ) {
+ $_favApps = eval {
+ from_json( $req->userData->{_favApps}, { allow_nonref => 1 } );
};
if ($@) {
- $self->logger->error("Corrupted session (_2fDevices): $@");
+ $self->logger->error("Corrupted session (_favApps): $@");
return $self->p->sendError( $req, "Corrupted session", 500 );
}
}
else {
- $self->logger->debug("No favorite Apps found");
- $_favapps = [];
+ $self->logger->debug("No favorite Apps found for $user");
+ $_favApps = [];
}
- push @$_favapps, $apps;
+ push @$_favApps, { app => $app, logo => '', description => '' };
$self->p->updatePersistentSession( $req,
- { _favapps => to_json($_favapps) } );
- $self->userLogger->notice("Apps registration of $apps succeeds for $user");
+ { _favApps => to_json($_favApps) } );
+ $self->userLogger->notice("Favorite apps registration of $app succeeds for $user");
return [
200,
diff --git a/lemonldap-ng-portal/site/coffee/favapps.coffee b/lemonldap-ng-portal/site/coffee/favapps.coffee
index 6aaf20ebd..7bdced20c 100644
--- a/lemonldap-ng-portal/site/coffee/favapps.coffee
+++ b/lemonldap-ng-portal/site/coffee/favapps.coffee
@@ -9,6 +9,8 @@ FavApps = (star, appuri) ->
url: "#{portal}favapps"
data:
app: appuri
+ logo: logo
+ title: title
dataType: 'json'
#error: star.attr('src', 'static/common/icons/star0.png')
success: (resp) ->
diff --git a/lemonldap-ng-portal/site/templates/bootstrap/menu.tpl b/lemonldap-ng-portal/site/templates/bootstrap/menu.tpl
index 9ac66310f..f30bb9e0f 100644
--- a/lemonldap-ng-portal/site/templates/bootstrap/menu.tpl
+++ b/lemonldap-ng-portal/site/templates/bootstrap/menu.tpl
@@ -27,12 +27,14 @@
Your applications
+
common/icons/vcard_edit.png" width="16" height="16" alt="password" />
@@ -114,11 +116,9 @@
card">
-
-
-
" src="
common/icons/star0.png"/>
+
+
" title="
" logo="common/apps/" src="common/icons/star0.png"/>
-
" title="" >