Skip to content

Commit f3d1132

Browse files
committed
Fix incorrect redirecting behavior
1 parent 0b38382 commit f3d1132

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

app/controllers/application_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ def authenticate_admin!
8484
def authenticate_user_and_running_if_single_contest!
8585
if @layout == :single_contest
8686
authenticate_user!
87+
return if performed?
8788
unless @contest.is_running?
8889
flash[:alert] = 'Contest is not running.'
8990
redirect_to single_contest_path(@contest)
91+
return
9092
end
9193
end
9294
end

app/controllers/concerns/single_contest_authentication_concern.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ def authenticate_user!(opts = {})
3131
if @layout == :single_contest
3232
return if user_signed_in?
3333
redirect_to sign_in_single_contest_path(@contest)
34+
return
3435
end
3536
super
3637
end
3738

3839
private
39-
40+
4041
def get_single_contest_user
4142
user_id = session.dig(:single_contest, @contest.id, :user_id)
4243
return nil if user_id.nil?

0 commit comments

Comments
 (0)