Project

General

Profile

Feature #33345 » improvement-ldap-error-message.patch

Yuichi HARADA, 2020-04-23 07:19

View differences:

app/models/auth_source_ldap.rb
end
end
rescue *NETWORK_EXCEPTIONS => e
raise AuthSourceException.new(e.message)
raise AuthSourceException.new(l(:error_can_not_connect_ldap, e.message))
end
# Test the connection to the LDAP
......
end
end
rescue *NETWORK_EXCEPTIONS => e
raise AuthSourceException.new(e.message)
raise AuthSourceException.new(l(:error_can_not_connect_ldap, e.message))
end
def auth_method_name
......
end
results
rescue *NETWORK_EXCEPTIONS => e
raise AuthSourceException.new(e.message)
raise AuthSourceException.new(l(:error_can_not_connect_ldap, e.message))
end
def ldap_mode
config/locales/en.yml
error_invalid_csv_file_or_settings: "The file is not a CSV file or does not match the settings below"
error_can_not_read_import_file: "An error occurred while reading the file to import"
error_attachment_extension_not_allowed: "Attachment extension %{extension} is not allowed"
error_can_not_connect_ldap: "Cannot connect to LDAP: %{value}"
error_ldap_bind_credentials: "Invalid LDAP Account/Password"
error_no_tracker_allowed_for_new_issue_in_project: "The project doesn't have any trackers for which you can create an issue"
error_no_projects_with_tracker_allowed_for_new_issue: "There are no projects with trackers for which you can create an issue"
test/unit/auth_source_ldap_test.rb
end
else
puts '(Test LDAP server not configured)'
def test_authenticate_with_cannot_connect_ldap
auth_source = AuthSourceLdap.find(1)
error = assert_raise(AuthSourceException) do
auth_source.authenticate('example1','123456')
end
assert_match /\ACannot connect to LDAP: /, error.message
end
def test_test_connection_with_cannot_connect_ldap
auth_source = AuthSourceLdap.find(1)
error = assert_raise(AuthSourceException) do
auth_source.test_connection
end
assert_match /\ACannot connect to LDAP: /, error.message
end
end
end
(3-3/4)