Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Show real error message on LDAP authentification
Browse files Browse the repository at this point in the history
Don't force error message to just be :invalid_username !

Signed-off-by: Romuald du Song <romuald.dusong@deveryware.com>
  • Loading branch information
rds13 authored and mssola committed Nov 23, 2015
1 parent 51fb588 commit 260eace
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/portus/ldap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def authenticate!
# strategy.
if @ldap.bind_as(bind_options)
user = find_or_create_user!
user.valid? ? success!(user) : fail!(:invalid_username)
user.valid? ? success!(user) : fail!(user.errors.full_messages.join(","))
else
fail!(:ldap_bind_failed)
end
Expand Down
3 changes: 2 additions & 1 deletion spec/lib/portus/ldap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ def load_configuration_test
APP_CONFIG["ldap"] = { "enabled" => true, "base" => "" }
lm = LdapMock.new(username: "", password: "1234")
lm.authenticate!
expect(lm.last_symbol).to be :invalid_username
expect(lm.last_symbol).to eq "Password is too short (minimum is 8 characters),"\
"Username Only alphanumeric characters are allowed. Minimum 4 characters, maximum 30."
end

it "returns a success if it was successful" do
Expand Down

0 comments on commit 260eace

Please sign in to comment.