How to not add an authentication widget when the user is already logged in ?
Added by Or Goshen over 4 years ago
Hi,
I have a weird issue.
On all your examples you keep the authWidget on screen at all times, but I would like to handle logout by myself (I figured that the way to do it is to call "session.login().logout();")
Issue that I'm facing is - how to know that user is logged in when a new Application object is created and not add the authWidget at all to the root() hierarchy ?
Apparently only when the authWidget is created there is even a check if the user is logged in or not.
Thanks,
Or
Replies (1)
RE: How to not add an authentication widget when the user is already logged in ? - Added by Roel Standaert over 4 years ago
Are you talking about when you're using a remember me cookie? That is indeed handled by AuthWidget::processEnvironment()
, but I think that you could look at its implementation to see how you could do it without an AuthWidget
.
You could also create an AuthWidget
but keep it invisible, or not add it as a widget. Note that by default the AuthWidget
shows message boxes in some cases. You may want to override those functions if you want it to be handled differently.