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 | 185 | end |
186 | 186 | |
187 | 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 | 189 | end |
190 | 190 | |
191 | 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 | 4 | |
5 | 5 | def valid? |
6 | 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 | 11 | return false unless user.try(:valid_password?, password) |
10 | 12 | |
13 | + email = user.email | |
14 | + | |
11 | 15 | # Set GL_USER env variable |
12 | 16 | ENV['GL_USER'] = email |
13 | 17 | # Pass Gitolite update hook |
... | ... | @@ -18,8 +22,8 @@ module Grack |
18 | 22 | @env['SCRIPT_NAME'] = "" |
19 | 23 | |
20 | 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 | 27 | return false unless project |
24 | 28 | end |
25 | 29 | ... | ... |