Project

General

Profile

« Previous | Next » 

Revision cf6de107

Added by Bernhard Suttner almost 3 years ago

Fixes #33197 - Show error message if credentials are wrong

View differences:

app/helpers/compute_resources_helper.rb
rescue Foreman::FingerprintException => e
compute.errors.add(:pubkey_hash, e.message)
[]
rescue Foreman::UsernameOrPasswordException => e
Foreman::Logging.exception("Failed listing datacenters", e)
compute.errors.add(:datacenter, e.message)
[]
rescue => e
Foreman::Logging.exception("Failed listing datacenters", e)
[]
app/models/compute_resources/foreman/model/vmware.rb
if e.message =~ /The remote system presented a public key with hash (\w+) but we're expecting a hash of/
raise Foreman::FingerprintException.new(
N_("The remote system presented a public key with hash %s but we're expecting a different hash. If you are sure the remote system is authentic, go to the compute resource edit page, press the 'Test Connection' or 'Load Datacenters' button and submit"), Regexp.last_match(1))
elsif e.message =~ /Cannot complete login due to an incorrect user name or password./
raise Foreman::UsernameOrPasswordException.new(
N_("Can not load datacenters due to an incorrect user name or password."))
else
raise e
end
lib/foreman/exception.rb
end
end
class UsernameOrPasswordException < Foreman::Exception
end
class MaintenanceException < Foreman::Exception
end

Also available in: Unified diff