1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

B #~: fix login with ruby version <= 2.0.0 (#1231)

Co-authored-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
Jorge Miguel Lobo Escalona 2021-05-19 13:30:41 +02:00 committed by GitHub
parent 7927c95553
commit 909775dd9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -543,8 +543,20 @@ helpers do
session[:federation_mode] = active_zone_configuration['FEDERATION/MODE'].upcase
session[:mode] = $conf[:mode]
auth = request.env['HTTP_AUTHORIZATION'].match(/(?<basic>\w+) (?<pass>\w+)/)
session[:auth] = auth[:pass]
if RUBY_VERSION > '2.0.0'
auth = request.env['HTTP_AUTHORIZATION'].match(/(?<basic>\w+) (?<pass>\w+)/)
session[:auth] = auth[:pass]
else
auth = request.env['HTTP_AUTHORIZATION'].split(" ")
if auth[0] && auth[0].downcase === 'basic'
session[:auth] = auth[1]
else
logger.info { 'Unauthorized login attempt' }
return [401, '']
end
end
#get firedge JWT
session[:fireedge_token] = get_fireedge_token(two_factor_auth_token)