Merge branch 'ldap-need-no-password' into 'master'

LDAP users don't need to set a password to Git over HTTP.

Fixes https://github.com/gitlabhq/gitlabhq/issues/8846.

See merge request !1575
This commit is contained in:
Marin Jankovski 2015-02-24 06:52:29 +00:00
commit ac918a5cdb
3 changed files with 7 additions and 2 deletions

View file

@ -45,6 +45,7 @@
# last_credential_check_at :datetime # last_credential_check_at :datetime
# github_access_token :string(255) # github_access_token :string(255)
# notification_email :string(255) # notification_email :string(255)
# password_automatically_set :boolean default(FALSE)
# #
require 'carrierwave/orm/activerecord' require 'carrierwave/orm/activerecord'
@ -350,6 +351,10 @@ class User < ActiveRecord::Base
keys.count == 0 keys.count == 0
end end
def require_password?
password_automatically_set? && !ldap_user?
end
def can_change_username? def can_change_username?
gitlab_config.username_changing_enabled gitlab_config.username_changing_enabled
end end

View file

@ -9,7 +9,7 @@
:"data-container" => "body"} :"data-container" => "body"}
SSH SSH
%button{ | %button{ |
class: "btn #{ 'active' if default_clone_protocol == 'http' }#{ ' has_tooltip' if current_user && current_user.password_automatically_set? }", | class: "btn #{ 'active' if default_clone_protocol == 'http' }#{ ' has_tooltip' if current_user && current_user.require_password? }", |
:"data-clone" => project.http_url_to_repo, | :"data-clone" => project.http_url_to_repo, |
:"data-title" => "Set a password on your account<br> to pull or push via #{gitlab_config.protocol.upcase}", :"data-title" => "Set a password on your account<br> to pull or push via #{gitlab_config.protocol.upcase}",
:"data-html" => "true", :"data-html" => "true",

View file

@ -1,4 +1,4 @@
- if cookies[:hide_no_password_message].blank? && !current_user.hide_no_password && current_user.password_automatically_set? - if cookies[:hide_no_password_message].blank? && !current_user.hide_no_password && current_user.require_password?
.no-password-message.alert.alert-warning.hidden-xs .no-password-message.alert.alert-warning.hidden-xs
You won't be able to pull or push project code via #{gitlab_config.protocol.upcase} until you #{link_to 'set a password', edit_profile_password_path} on your account You won't be able to pull or push project code via #{gitlab_config.protocol.upcase} until you #{link_to 'set a password', edit_profile_password_path} on your account