Project

General

Profile

automatic user login

Added by David Kauderer over 6 years ago

Hello,

I implemented a login based on the auth2 example into my application.

It works good so far, I just have one problem:

If someone opens the application he should login automagically as the user with the name nologin.

Unfortunately I couldn't figure out how to achieve this.

Can someone help me?

Thx in advance.

David


Replies (1)

RE: automatic user login - Added by David Kauderer over 6 years ago

For everyone who might need it:

@

// find user in the database:

Wt::Auth::User nologin = session_.users().findWithIdentity(Wt::Auth::Identity::LoginName,"userNameYouWantToLoginWith");

// log the user in:

session_.login().login(nologin);

@

Look simple but took me a while to find out. I'd find it nice to see an example regarding this in the Wt::Auth docs or examples.

    (1-1/1)