Skip to content

Commit

Permalink
Fixes #28196 - handle error when empty parameters passed
Browse files Browse the repository at this point in the history
  • Loading branch information
rabajaj0509 committed Nov 20, 2019
1 parent 98739de commit 1485f8e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/hammer_cli_foreman/api/oauth/password_grant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def set_token(input_oidc_token_endpoint, input_oidc_client_id, input_user, input
@user = input_user
@password = input_password
@oidc_client_id = input_oidc_client_id if input_oidc_client_id
if @user && @password && @oidc_token_endpoint && @oidc_client_id
if @user.to_s.empty? || @password.to_s.empty? || @oidc_token_endpoint.to_s.empty? || @oidc_client_id.to_s.empty?
@token = nil
else
@token = HammerCLIForeman::OpenidConnect.new(
@oidc_token_endpoint, @oidc_client_id).get_token(@user, @password)
else
@token = nil
end
end

Expand Down

0 comments on commit 1485f8e

Please sign in to comment.