How to return user name from vibed session?

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 10 05:23:29 PST 2015


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 session name
         writeln("username from req: ", 
request["username"].to!string);
         writeln("user name is: ", dbuser);
         writeln(request["username"].to!string, " == ", dbuser);
     }

But question about why I need to get session info like:

writeln("USER Session: ", req.session.get!string("username"));

is still actual.


More information about the Digitalmars-d-learn mailing list