BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
application_controller.rb
app/controllers/application_controller.rb
+9
-2
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,9 +17,16 @@ 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
sign_out
current_user
flash
[
:alert
]
=
"Your account was blocked"
redirect_to
new_user_session_path
end
...
...
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