Skip to content
Snippets Groups Projects
Commit 585eb705 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix http push with namespaces. Allow use of username as login

parent 1d857aae
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment