Skip to content

Commit

Permalink
Fixed extended session
Browse files Browse the repository at this point in the history
  • Loading branch information
farhatahmad committed Mar 11, 2024
1 parent 35a7227 commit 1c25679
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions app/controllers/external_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ def create_user
return redirect_to pending_path if user.pending?
end

user.generate_session_token!

# set the cookie based on session timeout setting
session_timeout = SettingGetter.new(setting_name: 'SessionTimeout', provider: current_provider).call
user.generate_session_token!(extended_session: session_timeout)
handle_session_timeout(session_timeout.to_i, user) if session_timeout

session[:session_token] = user.session_token
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def self.reset_token_expired?(sent_at)
# Gives the session token and expiry a default value before saving
def set_session_token
self.session_token = User.generate_digest(SecureRandom.alphanumeric(40))
self.session_expiry = 6.hours.from_now
self.session_expiry = 24.hours.from_now
end

def generate_session_token!(extended_session: false)
Expand Down

0 comments on commit 1c25679

Please sign in to comment.