diff options
author | Patricio Cano <suprnova32@gmail.com> | 2016-04-08 00:45:33 +0300 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2016-04-08 00:45:33 +0300 |
commit | 1d2429af9b0fd4ef1427c7676a50dae4e2cf0ff9 (patch) | |
tree | 664ea18074d0dc82cabd559334c254288023b8c4 /lib/gitlab/saml | |
parent | 4361cc395cb5b9574286dee09ac55e49f394e50e (diff) |
Add missing proper nil and error handling to SAML login process.
Diffstat (limited to 'lib/gitlab/saml')
-rw-r--r-- | lib/gitlab/saml/user.rb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/gitlab/saml/user.rb b/lib/gitlab/saml/user.rb index c1072452abe..dd77216be48 100644 --- a/lib/gitlab/saml/user.rb +++ b/lib/gitlab/saml/user.rb @@ -26,13 +26,15 @@ module Gitlab @user ||= build_new_user end - if external_users_enabled? - # Check if there is overlap between the user's groups and the external groups - # setting then set user as external or internal. - if (auth_hash.groups & Gitlab::Saml::Config.external_groups).empty? - @user.external = false - else - @user.external = true + unless @user.nil? + if external_users_enabled? + # Check if there is overlap between the user's groups and the external groups + # setting then set user as external or internal. + if (auth_hash.groups & Gitlab::Saml::Config.external_groups).empty? + @user.external = false + else + @user.external = true + end end end @@ -48,7 +50,11 @@ module Gitlab end def changed? - gl_user.changed? || gl_user.identities.any?(&:changed?) + if gl_user + gl_user.changed? || gl_user.identities.any?(&:changed?) + else + true + end end protected |