Commit 585eb70588ca80d5bcc48a03194f821077375873
1 parent
1d857aae
Exists in
master
and in
4 other branches
Fix http push with namespaces. Allow use of username as login
Showing
2 changed files
with
9 additions
and
5 deletions
Show diff stats
app/roles/repository.rb
@@ -185,7 +185,7 @@ module Repository | @@ -185,7 +185,7 @@ module Repository | ||
185 | end | 185 | end |
186 | 186 | ||
187 | def http_url_to_repo | 187 | def http_url_to_repo |
188 | - http_url = [Gitlab.config.url, "/", path, ".git"].join('') | 188 | + http_url = [Gitlab.config.url, "/", path_with_namespace, ".git"].join('') |
189 | end | 189 | end |
190 | 190 | ||
191 | # Check if current branch name is marked as protected in the system | 191 | # Check if current branch name is marked as protected in the system |
lib/gitlab/backend/grack_auth.rb
@@ -4,10 +4,14 @@ module Grack | @@ -4,10 +4,14 @@ module Grack | ||
4 | 4 | ||
5 | def valid? | 5 | def valid? |
6 | # Authentication with username and password | 6 | # Authentication with username and password |
7 | - email, password = @auth.credentials | ||
8 | - self.user = User.find_by_email(email) | 7 | + login, password = @auth.credentials |
8 | + | ||
9 | + self.user = User.find_by_email(login) || User.find_by_username(login) | ||
10 | + | ||
9 | return false unless user.try(:valid_password?, password) | 11 | return false unless user.try(:valid_password?, password) |
10 | 12 | ||
13 | + email = user.email | ||
14 | + | ||
11 | # Set GL_USER env variable | 15 | # Set GL_USER env variable |
12 | ENV['GL_USER'] = email | 16 | ENV['GL_USER'] = email |
13 | # Pass Gitolite update hook | 17 | # Pass Gitolite update hook |
@@ -18,8 +22,8 @@ module Grack | @@ -18,8 +22,8 @@ module Grack | ||
18 | @env['SCRIPT_NAME'] = "" | 22 | @env['SCRIPT_NAME'] = "" |
19 | 23 | ||
20 | # Find project by PATH_INFO from env | 24 | # Find project by PATH_INFO from env |
21 | - if m = /^\/([\w\.-]+)\.git/.match(@request.path_info).to_a | ||
22 | - self.project = Project.find_by_path(m.last) | 25 | + if m = /^\/([\w\.\/-]+)\.git/.match(@request.path_info).to_a |
26 | + self.project = Project.find_with_namespace(m.last) | ||
23 | return false unless project | 27 | return false unless project |
24 | end | 28 | end |
25 | 29 |