Fix http push with namespaces. Allow use of username as login
This commit is contained in:
parent
1d857aae17
commit
585eb70588
2 changed files with 9 additions and 5 deletions
|
@ -185,7 +185,7 @@ module Repository
|
||||||
end
|
end
|
||||||
|
|
||||||
def http_url_to_repo
|
def http_url_to_repo
|
||||||
http_url = [Gitlab.config.url, "/", path, ".git"].join('')
|
http_url = [Gitlab.config.url, "/", path_with_namespace, ".git"].join('')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if current branch name is marked as protected in the system
|
# Check if current branch name is marked as protected in the system
|
||||||
|
|
|
@ -4,10 +4,14 @@ module Grack
|
||||||
|
|
||||||
def valid?
|
def valid?
|
||||||
# Authentication with username and password
|
# Authentication with username and password
|
||||||
email, password = @auth.credentials
|
login, password = @auth.credentials
|
||||||
self.user = User.find_by_email(email)
|
|
||||||
|
self.user = User.find_by_email(login) || User.find_by_username(login)
|
||||||
|
|
||||||
return false unless user.try(:valid_password?, password)
|
return false unless user.try(:valid_password?, password)
|
||||||
|
|
||||||
|
email = user.email
|
||||||
|
|
||||||
# Set GL_USER env variable
|
# Set GL_USER env variable
|
||||||
ENV['GL_USER'] = email
|
ENV['GL_USER'] = email
|
||||||
# Pass Gitolite update hook
|
# Pass Gitolite update hook
|
||||||
|
@ -18,8 +22,8 @@ module Grack
|
||||||
@env['SCRIPT_NAME'] = ""
|
@env['SCRIPT_NAME'] = ""
|
||||||
|
|
||||||
# Find project by PATH_INFO from env
|
# Find project by PATH_INFO from env
|
||||||
if m = /^\/([\w\.-]+)\.git/.match(@request.path_info).to_a
|
if m = /^\/([\w\.\/-]+)\.git/.match(@request.path_info).to_a
|
||||||
self.project = Project.find_by_path(m.last)
|
self.project = Project.find_with_namespace(m.last)
|
||||||
return false unless project
|
return false unless project
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue