Commit 8a8123a3d4d3a5f991ae599e454b99fd548d47f2
1 parent
75b2ff8f
Exists in
master
and in
4 other branches
Update for readability
fixed a test a broke in the configurable theme PR Change-Id: Id894506941bc01ab0d259d48ca7ff9b80bb2c57e
Showing
2 changed files
with
8 additions
and
4 deletions
Show diff stats
lib/gitlab/ldap/user.rb
| ... | ... | @@ -44,11 +44,15 @@ module Gitlab |
| 44 | 44 | end |
| 45 | 45 | |
| 46 | 46 | def find_user(email) |
| 47 | - if user = model.find_by_email(email) | |
| 48 | - elsif ldap_conf['allow_username_or_email_login'] | |
| 49 | - uname = (email.partition('@').first) unless email.nil? | |
| 47 | + user = model.find_by_email(email) | |
| 48 | + | |
| 49 | + # If no user found and allow_username_or_email_login is true | |
| 50 | + # we look for user by extracting part of his email | |
| 51 | + if !user && email && ldap_conf['allow_username_or_email_login'] | |
| 52 | + uname = email.partition('@').first | |
| 50 | 53 | user = model.find_by_username(uname) |
| 51 | 54 | end |
| 55 | + | |
| 52 | 56 | user |
| 53 | 57 | end |
| 54 | 58 | ... | ... |
spec/models/user_spec.rb
| ... | ... | @@ -233,7 +233,7 @@ describe User do |
| 233 | 233 | it "should apply defaults to user" do |
| 234 | 234 | Gitlab.config.gitlab.default_projects_limit.should_not == 123 |
| 235 | 235 | Gitlab.config.gitlab.default_can_create_group.should_not be_true |
| 236 | - Gitlab.config.gitlab.default_theme.should_not == Gitlab::Theme::MARS | |
| 236 | + Gitlab.config.gitlab.default_theme.should_not == Gitlab::Theme::BASIC | |
| 237 | 237 | user.projects_limit.should == 123 |
| 238 | 238 | user.can_create_group.should be_true |
| 239 | 239 | user.theme_id.should == Gitlab::Theme::BASIC | ... | ... |