Skip to content

Commit b7d954e

Browse files
committed
Skip check_session_expiry in SessionsController
SessionsController skipped check_user_token but not check_session_expiry, so users with an expired session were shown the login page instead of completing the OAuth callback flow.
1 parent dd297ba commit b7d954e

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

app/controllers/sessions_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class SessionsController < ApplicationController
22
skip_before_action :check_user_token
3+
skip_before_action :check_session_expiry
34

45
def create
56
auth = request.env["omniauth.auth"]
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
require "test_helper"
22

33
class SessionsControllerTest < ActionDispatch::IntegrationTest
4-
# test "the truth" do
5-
# assert true
6-
# end
4+
test "completes OAuth even when session has expired" do
5+
# Sign in so the session gets an expires_at timestamp.
6+
sign_in
7+
8+
# Travel past the expiry window so check_session_expiry would fire.
9+
# Without the fix, it renders puzzles/login and the OAuth callback never completes.
10+
travel_to 2.hours.from_now do
11+
sign_in
12+
assert_redirected_to root_path
13+
end
14+
end
715
end

0 commit comments

Comments
 (0)