Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
cc3c6ad0
Commit
cc3c6ad0
authored
Jun 01, 2012
by
Nihad Abbasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow login via private token only for atom feeds
parent
f8f6ff06
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+9
-2
spec/requests/projects_spec.rb
spec/requests/projects_spec.rb
+7
-0
No files found.
app/controllers/application_controller.rb
View file @
cc3c6ad0
class
ApplicationController
<
ActionController
::
Base
before_filter
:authenticate_user!
before_filter
:reject_blocked!
before_filter
:set_current_user_for_mailer
before_filter
:set_current_user_for_mailer
,
:check_token_auth
protect_from_forgery
helper_method
:abilities
,
:can?
...
...
@@ -17,6 +17,13 @@ class ApplicationController < ActionController::Base
protected
def
check_token_auth
# Redirect to login page if not atom feed
if
params
[
:private_token
].
present?
&&
params
[
:format
]
!=
'atom'
redirect_to
new_user_session_path
end
end
def
reject_blocked!
if
current_user
&&
current_user
.
blocked
sign_out
current_user
...
...
spec/requests/projects_spec.rb
View file @
cc3c6ad0
...
...
@@ -28,6 +28,13 @@ describe "Projects" do
visit
projects_path
(
:atom
,
:private_token
=>
@user
.
private_token
)
page
.
body
.
should
have_selector
(
"feed title"
)
end
it
"should not render projects page via private token"
do
logout
visit
projects_path
(
:private_token
=>
@user
.
private_token
)
current_path
.
should
==
new_user_session_path
end
end
describe
"GET /projects/new"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment