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
Boxiang Sun
gitlab-ce
Commits
26d1bd7c
Commit
26d1bd7c
authored
Jun 19, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set return url as param.
parent
2c362688
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
19 deletions
+17
-19
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-13
app/controllers/users_sessions_controller.rb
app/controllers/users_sessions_controller.rb
+6
-0
app/views/devise/sessions/_new_base.html.haml
app/views/devise/sessions/_new_base.html.haml
+2
-2
app/views/layouts/_public_head_panel.html.haml
app/views/layouts/_public_head_panel.html.haml
+2
-2
config/routes.rb
config/routes.rb
+1
-1
features/project/redirects.feature
features/project/redirects.feature
+1
-1
features/steps/project/redirects.rb
features/steps/project/redirects.rb
+4
-0
No files found.
app/controllers/application_controller.rb
View file @
26d1bd7c
require
'gon'
require
'gon'
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
ActionController
::
Base
before_filter
:store_location
before_filter
:authenticate_user!
before_filter
:authenticate_user!
before_filter
:reject_blocked!
before_filter
:reject_blocked!
before_filter
:check_password_expiration
before_filter
:check_password_expiration
...
@@ -49,18 +48,7 @@ class ApplicationController < ActionController::Base
...
@@ -49,18 +48,7 @@ class ApplicationController < ActionController::Base
flash
[
:alert
]
=
"Your account is blocked. Retry when an admin has unblocked it."
flash
[
:alert
]
=
"Your account is blocked. Retry when an admin has unblocked it."
new_user_session_path
new_user_session_path
else
else
session
[
:previous_url
]
||
root_path
@return_to
||
root_path
end
end
def
store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
if
(
request
.
fullpath
!=
"/users/sign_in"
&&
request
.
fullpath
!=
"/users/sign_up"
&&
request
.
fullpath
!=
"/users/password"
&&
request
.
fullpath
!=
"/users/sign_out"
&&
!
request
.
xhr?
)
# don't store ajax calls
session
[
:previous_url
]
=
request
.
fullpath
end
end
end
end
...
...
app/controllers/users_sessions_controller.rb
0 → 100644
View file @
26d1bd7c
class
UsersSessionsController
<
Devise
::
SessionsController
def
create
@return_to
=
params
[
:return_to
]
super
end
end
app/views/devise/sessions/_new_base.html.haml
View file @
26d1bd7c
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
=
f
.
check_box
:remember_me
=
f
.
check_box
:remember_me
%span
Remember me
%span
Remember me
%div
%div
=
hidden_field_tag
'return_to'
,
params
[
:return_to
]
=
f
.
submit
"Sign in"
,
class:
"btn-create btn"
=
f
.
submit
"Sign in"
,
class:
"btn-create btn"
.pull-right
.pull-right
=
link_to
"Forgot your password?"
,
new_password_path
(
resource_name
),
class:
"btn"
=
link_to
"Forgot your password?"
,
new_password_path
(
resource_name
),
class:
"btn"
app/views/layouts/_public_head_panel.html.haml
View file @
26d1bd7c
...
@@ -13,10 +13,10 @@
...
@@ -13,10 +13,10 @@
%i
.icon-reorder
%i
.icon-reorder
.pull-right.hidden-xs
.pull-right.hidden-xs
=
link_to
"Sign in"
,
new_session_path
(
:user
),
class:
'btn btn-sign-in btn-new'
=
link_to
"Sign in"
,
new_session_path
(
:user
,
return_to:
request
.
fullpath
),
class:
'btn btn-sign-in btn-new'
.navbar-collapse.collapse
.navbar-collapse.collapse
%ul
.nav.navbar-nav
%ul
.nav.navbar-nav
%li
.visible-xs
%li
.visible-xs
=
link_to
"Sign in"
,
new_session_path
(
:user
)
=
link_to
"Sign in"
,
new_session_path
(
:user
,
return_to:
request
.
fullpath
)
config/routes.rb
View file @
26d1bd7c
...
@@ -157,7 +157,7 @@ Gitlab::Application.routes.draw do
...
@@ -157,7 +157,7 @@ Gitlab::Application.routes.draw do
resources
:projects
,
constraints:
{
id:
/[^\/]+/
},
only:
[
:new
,
:create
]
resources
:projects
,
constraints:
{
id:
/[^\/]+/
},
only:
[
:new
,
:create
]
devise_for
:users
,
controllers:
{
omniauth_callbacks: :omniauth_callbacks
,
registrations: :registrations
,
passwords: :passwords
}
devise_for
:users
,
controllers:
{
omniauth_callbacks: :omniauth_callbacks
,
registrations: :registrations
,
passwords: :passwords
,
sessions: :users_sessions
}
#
#
# Project Area
# Project Area
...
...
features/project/redirects.feature
View file @
26d1bd7c
...
@@ -28,5 +28,5 @@ Feature: Project Redirects
...
@@ -28,5 +28,5 @@ Feature: Project Redirects
Scenario
:
I
visit a public project without signing in
Scenario
:
I
visit a public project without signing in
When
I visit project
"Community"
page
When
I visit project
"Community"
page
And
I should see project
"Community"
home page
And
I should see project
"Community"
home page
And
I
sign in as a user
And
I
click on
"Sign In"
Then
I should be redirected to
"Community"
page
Then
I should be redirected to
"Community"
page
features/steps/project/redirects.rb
View file @
26d1bd7c
...
@@ -32,6 +32,10 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
...
@@ -32,6 +32,10 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
visit
project_path
(
project
)
+
'DoesNotExist'
visit
project_path
(
project
)
+
'DoesNotExist'
end
end
step
'I click on "Sign In"'
do
click_link
"Sign in"
end
step
'I should be redirected to "Community" page'
do
step
'I should be redirected to "Community" page'
do
project
=
Project
.
find_by
(
name:
'Community'
)
project
=
Project
.
find_by
(
name:
'Community'
)
page
.
current_path
.
should
==
"/
#{
project
.
path_with_namespace
}
"
page
.
current_path
.
should
==
"/
#{
project
.
path_with_namespace
}
"
...
...
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