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/user.rb | |
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/user.rb')
-rw-r--r-- | app/models/user.rb | 12 |
1 files changed, 8 insertions, 4 deletions
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 |