Possible bug with extend_remember_deadline functionality #331
mikereczek
started this conversation in
General
Replies: 3 comments
-
Your approach seems reasonable to me. Something like this?: diff --git a/lib/rodauth/features/remember.rb b/lib/rodauth/features/remember.rb
index 8e1263f..0287960 100644
--- a/lib/rodauth/features/remember.rb
+++ b/lib/rodauth/features/remember.rb
@@ -114,8 +114,12 @@ module Rodauth
def load_memory
if logged_in?
if extend_remember_deadline_while_logged_in?
- account_from_session
- extend_remember_deadline
+ if account_from_session
+ extend_remember_deadline
+ else
+ forget_login
+ clear_session
+ end
end
elsif account_from_remember_cookie
before_load_memory |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you - yes. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Fixed: 5968d21 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Jeremy,
I'm coming over from rodauth-rails (@janko) but I believe this to be a rodauth issue.
I occasionally get the following error at
rodauth.load_memory
in development after resetting the database and repopulating my accounts table with records (note that accountid
is a uuid and is different after each db reset):Note that whenever I see the error:
extend_remember_deadline? true
I believe what's happening here is that rodauth thinks there should be an account based on the session cookie and then tries to update
account_remember_keys
without first checking that it did indeed find an account record.I hesitated to call this a bug (hence the discussion) since the path I took to get it is kind of obscure, but I presume the same would happen in production if a site admin deletes an account while that account is logged in, or if an end user deletes their own account while logged in on another browser.
I propose that there should be an account check before trying to extend the remember cookie, and if none is found, it should delete the remember cookie and reset the session.
Thoughts?
Thank you for your work on rodauth!
Beta Was this translation helpful? Give feedback.
All reactions