Hello.
I have implemented the member login and register functionality from the Umbraco Docs (Link to docs). The docs didn't show the remember me button, but it is present when you follow the docs.
But no matter how many docs or forum posts I read, I can't find a way to change the default timeout for the remember me button. Code below shows the Macro snippet that Umbraco creates.
.AspNetCore.Identity.Application Expires/Maxage Fri, 18 Aug 2023 08:57:09 GMT
My testing is as follows:
One user press the remember me button, and logs in. Then wait for the amount of time the cookie is set to. Then refreshes the browser.
Another user doesn't press the remember me button, and logs in. Then wait for the amount of time the cookie is set to. Then refreshes the browser.
Both gets logged out at the same time.
Another test:
Both users refresh the browser before the cookie expires. Both remains logged in.
At this point, I'm not really sure why both users gets logged out at the same time, even if one has not pressed the button.
Are you maybe confusing session timeout and authentication timeouts, they are not the same thing.
if Session times out before the Authentication cookie - they are still authenticated, but all their session variables disappear, and may cause errors in your website if you are not disciplined in checking for nulls and other conditions brought about by missing session.
If Authentication times out before the session, then all their session variables will still exist, but they won't be able to access protected resources until they log back in again.
I see what you mean. I realized my testing was wrong. I set the ExpireTimeSpan to be 2 minutes to see the result faster. But after a lot more testing, it works. Thank you for your patience :)) and I apologise for my flawed testing.
Login Remember Me Button
Hello. I have implemented the member login and register functionality from the Umbraco Docs (Link to docs). The docs didn't show the remember me button, but it is present when you follow the docs.
But no matter how many docs or forum posts I read, I can't find a way to change the default timeout for the remember me button. Code below shows the Macro snippet that Umbraco creates.
EDIT: I have seen that you can create a global cookie in appsettings, but I need remember me to be able to be turned on or off.
What I would like to ask is, how do I change the default timeout for the member that is signing in, with the remember me button?
Thank you in advance. Kind regards
Rasmus.
You can add this to the ConfigureServices method in startup.cs
This is making a global cookie. It doesn't take the "Remember me" button into account.
Yes it does, it sets the expiry time of the authcookie set when you select rememberme
Cookie without rememberme
cokie with rememberme set with 14 day timeout
I see the same results as you, but the user still gets logged out after the same time frame.
I do see the same cookies as you:
Not pressed button:
Pressed button:
My testing is as follows: One user press the remember me button, and logs in. Then wait for the amount of time the cookie is set to. Then refreshes the browser.
Another user doesn't press the remember me button, and logs in. Then wait for the amount of time the cookie is set to. Then refreshes the browser.
Both gets logged out at the same time.
Another test: Both users refresh the browser before the cookie expires. Both remains logged in.
At this point, I'm not really sure why both users gets logged out at the same time, even if one has not pressed the button.
Are you maybe confusing session timeout and authentication timeouts, they are not the same thing.
if Session times out before the Authentication cookie - they are still authenticated, but all their session variables disappear, and may cause errors in your website if you are not disciplined in checking for nulls and other conditions brought about by missing session.
If Authentication times out before the session, then all their session variables will still exist, but they won't be able to access protected resources until they log back in again.
I see what you mean. I realized my testing was wrong. I set the
ExpireTimeSpan
to be 2 minutes to see the result faster. But after a lot more testing, it works. Thank you for your patience :)) and I apologise for my flawed testing.No problem :) These subtleties can be difficult to get your head round sometimes.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.