Skip to content

Commit

Permalink
fix token auth
Browse files Browse the repository at this point in the history
  • Loading branch information
stgm committed Dec 19, 2020
1 parent 91e5601 commit e9d0b5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/helpers/authentication_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def current_user
private

def load_current_user
if authenticated? && login = Login.where(login: (request.session['cas']['user']).downcase).first
if request.session['token'].present?
if user = User.where(token: request.session['token']).first
@current_user = user
end
elsif request.session['cas'].present? && login = Login.where(login: (request.session['cas']['user']).downcase).first
@current_user = login.user
else
# use an empty user object in case of no login
Expand Down

0 comments on commit e9d0b5a

Please sign in to comment.