Commit 7257940c authored by Douwe Maan's avatar Douwe Maan Committed by Dmitriy Zaporozhets

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

parent 9b7633f1
...@@ -45,6 +45,7 @@ ...@@ -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 ...@@ -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
......
...@@ -9,7 +9,7 @@ ...@@ -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",
......
- 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment