Merge pull request #2213 from ZeiP/feature/2203_token_basic_auth

#2203: Try to use basic password also as a token when accessing a tok…
This commit is contained in:
Matt Rogers 2019-05-06 08:08:50 -05:00 committed by GitHub
commit 1956c59cb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,10 +72,17 @@ module LoginSystem
def login_or_feed_token_required
if ['rss', 'atom', 'txt', 'ics', 'xml'].include?(params[:format])
# Login based on the token GET parameter
if user = User.where(:token => params[:token]).first
set_current_user(user)
return true
end
# Allow also login based on auth data
auth = get_basic_auth_data
if user = User.where(:login => auth[:user], :token => auth[:pass]).first
set_current_user(user)
return true
end
end
login_required
end