Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
26d1bd7c
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
26d1bd7c
编写于
6月 19, 2014
作者:
M
Marin Jankovski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Set return url as param.
上级
2c362688
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
17 addition
and
19 deletion
+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
未找到文件。
app/controllers/application_controller.rb
浏览文件 @
26d1bd7c
require
'gon'
class
ApplicationController
<
ActionController
::
Base
before_filter
:store_location
before_filter
:authenticate_user!
before_filter
:reject_blocked!
before_filter
:check_password_expiration
...
...
@@ -49,18 +48,7 @@ class ApplicationController < ActionController::Base
flash
[
:alert
]
=
"Your account is blocked. Retry when an admin has unblocked it."
new_user_session_path
else
session
[
:previous_url
]
||
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
@return_to
||
root_path
end
end
...
...
app/controllers/users_sessions_controller.rb
0 → 100644
浏览文件 @
26d1bd7c
class
UsersSessionsController
<
Devise
::
SessionsController
def
create
@return_to
=
params
[
:return_to
]
super
end
end
app/views/devise/sessions/_new_base.html.haml
浏览文件 @
26d1bd7c
...
...
@@ -7,8 +7,8 @@
=
f
.
check_box
:remember_me
%span
Remember me
%div
=
hidden_field_tag
'return_to'
,
params
[
:return_to
]
=
f
.
submit
"Sign in"
,
class:
"btn-create btn"
.pull-right
=
link_to
"Forgot your password?"
,
new_password_path
(
resource_name
),
class:
"btn"
app/views/layouts/_public_head_panel.html.haml
浏览文件 @
26d1bd7c
...
...
@@ -13,10 +13,10 @@
%i
.icon-reorder
.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
%ul
.nav.navbar-nav
%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
浏览文件 @
26d1bd7c
...
...
@@ -157,7 +157,7 @@ Gitlab::Application.routes.draw do
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
...
...
features/project/redirects.feature
浏览文件 @
26d1bd7c
...
...
@@ -28,5 +28,5 @@ Feature: Project Redirects
Scenario
:
I
visit a public project without signing in
When
I visit project
"Community"
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
features/steps/project/redirects.rb
浏览文件 @
26d1bd7c
...
...
@@ -32,6 +32,10 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
visit
project_path
(
project
)
+
'DoesNotExist'
end
step
'I click on "Sign In"'
do
click_link
"Sign in"
end
step
'I should be redirected to "Community" page'
do
project
=
Project
.
find_by
(
name:
'Community'
)
page
.
current_path
.
should
==
"/
#{
project
.
path_with_namespace
}
"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录