summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-02-23 22:21:49 +0100
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-23 23:28:34 -0800
commit7257940c52b05040c44f0aba300c7a787d0c275e (patch)
tree23d57d513fa447fb4d40ccd8c6525a0122ad05ce
parent9b7633f10bf1a0995e0cbfc5ac2a84615df1207e (diff)
downloadgitlab-ce-7257940c52b05040c44f0aba300c7a787d0c275e.tar.gz
LDAP users don't need to set a password to Git over HTTP.
-rw-r--r--app/models/user.rb5
-rw-r--r--app/views/shared/_clone_panel.html.haml2
-rw-r--r--app/views/shared/_no_password.html.haml2
3 files changed, 7 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index a9776b633a6..b203b57060e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -45,6 +45,7 @@
# last_credential_check_at :datetime
# github_access_token :string(255)
# notification_email :string(255)
+# password_automatically_set :boolean default(FALSE)
#
require 'carrierwave/orm/activerecord'
@@ -350,6 +351,10 @@ class User < ActiveRecord::Base
keys.count == 0
end
+ def require_password?
+ password_automatically_set? && !ldap_user?
+ end
+
def can_change_username?
gitlab_config.username_changing_enabled
end
diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml
index df0bde76980..a1121750ca3 100644
--- a/app/views/shared/_clone_panel.html.haml
+++ b/app/views/shared/_clone_panel.html.haml
@@ -9,7 +9,7 @@
:"data-container" => "body"}
SSH
%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-title" => "Set a password on your account<br> to pull or push via #{gitlab_config.protocol.upcase}",
:"data-html" => "true",
diff --git a/app/views/shared/_no_password.html.haml b/app/views/shared/_no_password.html.haml
index 022097cda16..a43bf33751a 100644
--- a/app/views/shared/_no_password.html.haml
+++ b/app/views/shared/_no_password.html.haml
@@ -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
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