Re: How to return user name from vibed session?

2015-12-10 Thread Adrian Matoga via Digitalmars-d-learn
On Thursday, 10 December 2015 at 11:36:20 UTC, Suliman wrote: Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set user name for session like this: req.session.set("username", "admin"); But I can't understand how to get user name from it: abstract

How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set user name for session like this: req.session.set("username", "admin"); But I can't understand how to get user name from it: abstract std.variant.VariantN!(20) get( string id, string name,

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 12:30:51 UTC, Suliman wrote: On Thursday, 10 December 2015 at 12:21:40 UTC, Adrian Matoga wrote: On Thursday, 10 December 2015 at 11:36:20 UTC, Suliman wrote: Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set

Re: How to return user name from vibed session?

2015-12-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote: But question about why I need to get session info like: writeln("USER Session: ", req.session.get!string("username")); is still actual. When you have a template that looks like this: V get(V, K)(K key) {...} The compiler is

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:34:02 UTC, Mike Parker wrote: On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote: But question about why I need to get session info like: writeln("USER Session: ", req.session.get!string("username")); is still actual. When you have a template

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 12:21:40 UTC, Adrian Matoga wrote: On Thursday, 10 December 2015 at 11:36:20 UTC, Suliman wrote: Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set user name for session like this: req.session.set("username",

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:43:58 UTC, Suliman wrote: On Thursday, 10 December 2015 at 13:34:02 UTC, Mike Parker wrote: On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote: But question about why I need to get session info like: writeln("USER Session: ",

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
Oh, my issue. Right variant of setting session is: if(dbuser == "admin") // admin name hardcoded { _auth.isAuthorizated = true; req.session.set("username", "admin"); } else { req.session.set("username", dbuser); //set current username in parameter of

Re: How to return user name from vibed session?

2015-12-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:46:19 UTC, Suliman wrote: because set return void, and get return T? No, it has nothing to do with the return type declarations. It's about whether or not the compiler has enough information to deduce the types. V get(V, K)(K key, V defaultVal); auto