diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-07-14 08:49:36 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-07-14 08:49:36 +0000 |
commit | 1afdbe320e60aa227dfd75ae1f1f128106660c8a (patch) | |
tree | 38e91b764c45b2f0074829560325d0f4b2b4ae39 /app/models | |
parent | febd3884a293859a63d2a7ae83b969fc33448f26 (diff) | |
parent | 672a68d3724bcae676d18244c85566e7d664a169 (diff) | |
download | gitlab-ce-1afdbe320e60aa227dfd75ae1f1f128106660c8a.tar.gz |
Merge branch 'fixes-for-internal-auth-disabled' into 'master'
Fixes needed when GitLab sign-in is not enabled
See merge request !12491
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/application_setting.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 98e3906a932..898ce45f60e 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -237,6 +237,7 @@ class ApplicationSetting < ActiveRecord::Base koding_url: nil, max_artifacts_size: Settings.artifacts['max_size'], max_attachment_size: Settings.gitlab['max_attachment_size'], + password_authentication_enabled: Settings.gitlab['password_authentication_enabled'], performance_bar_allowed_group_id: nil, plantuml_enabled: false, plantuml_url: nil, @@ -251,7 +252,6 @@ class ApplicationSetting < ActiveRecord::Base shared_runners_text: nil, sidekiq_throttling_enabled: false, sign_in_text: nil, - signin_enabled: Settings.gitlab['signin_enabled'], signup_enabled: Settings.gitlab['signup_enabled'], terminal_max_session_time: 0, two_factor_grace_period: 48, diff --git a/app/models/user.rb b/app/models/user.rb index 2d39b1c1c34..dd1a391773a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -580,16 +580,20 @@ class User < ActiveRecord::Base keys.count == 0 && Gitlab::ProtocolAccess.allowed?('ssh') end - def require_password? - password_automatically_set? && !ldap_user? && current_application_settings.signin_enabled? + def require_password_creation? + password_automatically_set? && allow_password_authentication? end - def require_personal_access_token? - return false if current_application_settings.signin_enabled? || ldap_user? + def require_personal_access_token_creation_for_git_auth? + return false if allow_password_authentication? || ldap_user? PersonalAccessTokensFinder.new(user: self, impersonation: false, state: 'active').execute.none? end + def allow_password_authentication? + !ldap_user? && current_application_settings.password_authentication_enabled? + end + def can_change_username? gitlab_config.username_changing_enabled end |