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
8da8efb3
Commit
8da8efb3
authored
Jul 11, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'redirect_on_signin' into 'master'
Redirect on signin Fixes #1346 See merge request !965
parents
f3b0cb77
3b80d68f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
15 deletions
+41
-15
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+14
-0
app/controllers/users_sessions_controller.rb
app/controllers/users_sessions_controller.rb
+0
-6
app/views/devise/sessions/_new_base.html.haml
app/views/devise/sessions/_new_base.html.haml
+3
-3
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
+5
-0
features/steps/project/redirects.rb
features/steps/project/redirects.rb
+15
-2
No files found.
app/controllers/application_controller.rb
View file @
8da8efb3
...
@@ -68,7 +68,7 @@ class ApplicationController < ActionController::Base
...
@@ -68,7 +68,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
@return_to
||
root_path
stored_location_for
(
:redirect
)
||
stored_location_for
(
resource
)
||
root_path
end
end
end
end
...
...
app/controllers/sessions_controller.rb
0 → 100644
View file @
8da8efb3
class
SessionsController
<
Devise
::
SessionsController
def
new
if
request
.
referer
.
present?
store_location_for
(
:redirect
,
URI
(
request
.
referer
).
path
)
end
super
end
def
create
super
end
end
app/controllers/users_sessions_controller.rb
deleted
100644 → 0
View file @
f3b0cb77
class
UsersSessionsController
<
Devise
::
SessionsController
def
create
@return_to
=
params
[
:return_to
]
super
end
end
app/views/devise/sessions/_new_base.html.haml
View file @
8da8efb3
...
@@ -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-save 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 @
8da8efb3
...
@@ -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
,
return_to:
request
.
fullpath
),
class:
'btn btn-sign-in btn-new'
=
link_to
"Sign in"
,
new_session_path
(
:user
),
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
,
return_to:
request
.
fullpath
)
=
link_to
"Sign in"
,
new_session_path
(
:user
)
config/routes.rb
View file @
8da8efb3
...
@@ -160,7 +160,7 @@ Gitlab::Application.routes.draw do
...
@@ -160,7 +160,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
,
sessions: :
users_
sessions
}
devise_for
:users
,
controllers:
{
omniauth_callbacks: :omniauth_callbacks
,
registrations: :registrations
,
passwords: :passwords
,
sessions: :sessions
}
devise_scope
:user
do
devise_scope
:user
do
get
"/users/auth/:provider/omniauth_error"
=>
"omniauth_callbacks#omniauth_error"
,
as: :omniauth_error
get
"/users/auth/:provider/omniauth_error"
=>
"omniauth_callbacks#omniauth_error"
,
as: :omniauth_error
...
...
features/project/redirects.feature
View file @
8da8efb3
...
@@ -31,3 +31,8 @@ Feature: Project Redirects
...
@@ -31,3 +31,8 @@ Feature: Project Redirects
And
I click on
"Sign In"
And
I click on
"Sign In"
And
Authenticate
And
Authenticate
Then
I should be redirected to
"Community"
page
Then
I should be redirected to
"Community"
page
Scenario
:
I
visit private project page without signing in
When
I visit project
"Enterprise"
page
And
I get redirected to signin page where I sign in
Then
I should be redirected to
"Enterprise"
page
features/steps/project/redirects.rb
View file @
8da8efb3
...
@@ -41,7 +41,6 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
...
@@ -41,7 +41,6 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step
'Authenticate'
do
step
'Authenticate'
do
admin
=
create
(
:admin
)
admin
=
create
(
:admin
)
project
=
Project
.
find_by
(
name:
'Community'
)
project
=
Project
.
find_by
(
name:
'Community'
)
find
(
:xpath
,
"//input[@id='return_to']"
).
set
"/
#{
project
.
path_with_namespace
}
"
fill_in
"user_login"
,
with:
admin
.
email
fill_in
"user_login"
,
with:
admin
.
email
fill_in
"user_password"
,
with:
admin
.
password
fill_in
"user_password"
,
with:
admin
.
password
click_button
"Sign in"
click_button
"Sign in"
...
@@ -53,5 +52,19 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
...
@@ -53,5 +52,19 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
page
.
current_path
.
should
==
"/
#{
project
.
path_with_namespace
}
"
page
.
current_path
.
should
==
"/
#{
project
.
path_with_namespace
}
"
page
.
status_code
.
should
==
200
page
.
status_code
.
should
==
200
end
end
end
step
'I get redirected to signin page where I sign in'
do
admin
=
create
(
:admin
)
project
=
Project
.
find_by
(
name:
'Enterprise'
)
fill_in
"user_login"
,
with:
admin
.
email
fill_in
"user_password"
,
with:
admin
.
password
click_button
"Sign in"
Thread
.
current
[
:current_user
]
=
admin
end
step
'I should be redirected to "Enterprise" page'
do
project
=
Project
.
find_by
(
name:
'Enterprise'
)
page
.
current_path
.
should
==
"/
#{
project
.
path_with_namespace
}
"
page
.
status_code
.
should
==
200
end
end
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