// mapped to "/hq" in Routes public Result hq(Context context) { logger.debug("account: "+context.getSession().get("account")); return Results.html(); }
This display
account; null
And obviously, the variable session.account can't be retrieved in the template.
It really can't be more simple. I'm seeing it work in every ninja framework example. I must be missing something big !
Thank you for your help.
Eric PROTAT
unread,
Sep 28, 2014, 5:34:37 PM9/28/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninja-f...@googlegroups.com
Code has been simplified in my examples. Consider the "user.getAccount()" as an hardcoded string, This does not change anything to the problem.
And if I log the "account" session variable at the end of the "login" controller method, the logger displays the good value. I 'seems to be lost in the redirect.
Stéphane Cl
unread,
Sep 29, 2014, 2:47:21 AM9/29/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninja-f...@googlegroups.com
I haven't used sessions much but I would check the session cookie in the browser. Is it properly created? Does it contain any value?
Another possible explanation is that "user.getAccount()" returns null but you have probably triple-checked that already.
Eric PROTAT
unread,
Sep 29, 2014, 7:21:18 AM9/29/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninja-f...@googlegroups.com
Yes consider that I hardcoded a value in the session.put() call.
What I'm missing is perhaps the way I create the cookie. In fact, I just did nothing explicit about it, excepted set the cookie prefix in application.conf file. Is there any thing special to do ?
Stéphane Cl
unread,
Sep 29, 2014, 8:05:34 AM9/29/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninja-f...@googlegroups.com
Nothing special to do according to the docs, however it would still be interesting to inspect the cookie on client-side.
Eric PROTAT
unread,
Sep 29, 2014, 5:58:44 PM9/29/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninja-f...@googlegroups.com
After submitting the login form, I can see on the server side that the user is authentified, and that the user id is set in the session. I can see in the cookie on the client side that the user id is in it.
However, I'm unable to display anything in the current page, and in controllers after more requests.
I didn't mention I'm using Mustache templating, but, on the cookie and session management, code is the same.
Eric PROTAT
unread,
Sep 29, 2014, 6:30:16 PM9/29/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninja-f...@googlegroups.com
Found it !
application.session.transferred_over_https_only=true ... and I was not in HTTPS for development.
I said it was probably dumb ... Thank you for your help.
Raphael André Bauer
unread,
Sep 30, 2014, 2:43:49 AM9/30/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninja-f...@googlegroups.com
That's very cool!
I was just about to write back - but you already found the issue :)
Is there anything we could do to improve the docs in that regard?
If you have problems like that it's always cool to debug via Firebug,
curl or the debug console of Chrome. This always helps me to find
those kind of issues :)
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninja-f...@googlegroups.com
Hi !
Just a warning point in the "Sessions" chapter describing the cookie settings in application.conf could be useful. But it seems I'm the only one having this issue :)
Regards,
Eric
Moses Gone
unread,
Jul 6, 2018, 4:30:40 AM7/6/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ninja-framework
No you are not the only one having this problem, I struggled for several hours with this. Just couldnt figur eout where and when my session was getting cleaned-off attributes. And indeed, I was on dev mode and I had set my application.session.transferred_over_https_only settings to true. Changing it back to false solved the issue