diff --git a/app/roles/repository.rb b/app/roles/repository.rb index ba61aa4ce47dad9fa5ea6aad7dbe0b353762df1c..c655ec9571c88a46b4f415efd33f78e50b502798 100644 --- a/app/roles/repository.rb +++ b/app/roles/repository.rb @@ -185,7 +185,7 @@ module Repository end def http_url_to_repo - http_url = [Gitlab.config.url, "/", path, ".git"].join('') + http_url = [Gitlab.config.url, "/", path_with_namespace, ".git"].join('') end # Check if current branch name is marked as protected in the system diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index dd5a9becafc386c0644a0be302b65af4f772f42f..9fafc9617d17d5f5475281f1aeb381ce187bb8f1 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -4,10 +4,14 @@ module Grack def valid? # Authentication with username and password - email, password = @auth.credentials - self.user = User.find_by_email(email) + login, password = @auth.credentials + + self.user = User.find_by_email(login) || User.find_by_username(login) + return false unless user.try(:valid_password?, password) + email = user.email + # Set GL_USER env variable ENV['GL_USER'] = email # Pass Gitolite update hook @@ -18,8 +22,8 @@ module Grack @env['SCRIPT_NAME'] = "" # Find project by PATH_INFO from env - if m = /^\/([\w\.-]+)\.git/.match(@request.path_info).to_a - self.project = Project.find_by_path(m.last) + if m = /^\/([\w\.\/-]+)\.git/.match(@request.path_info).to_a + self.project = Project.find_with_namespace(m.last) return false unless project end