Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
7bb84e64
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,发现更多精彩内容 >>
提交
7bb84e64
编写于
5月 06, 2016
作者:
F
Felipe Artur
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change landing page when skipping confirmation email and add documentation
上级
0baadd6c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
48 addition
and
17 deletion
+48
-17
app/controllers/registrations_controller.rb
app/controllers/registrations_controller.rb
+2
-2
app/views/admin/application_settings/_form.html.haml
app/views/admin/application_settings/_form.html.haml
+2
-2
db/migrate/20160421141709_add_send_confirmation_email_to_application_settings.rb
...09_add_send_confirmation_email_to_application_settings.rb
+1
-1
doc/security/README.md
doc/security/README.md
+1
-0
doc/security/user_email_confirmation.md
doc/security/user_email_confirmation.md
+7
-0
spec/controllers/registrations_controller_spec.rb
spec/controllers/registrations_controller_spec.rb
+1
-1
spec/features/signup_spec.rb
spec/features/signup_spec.rb
+34
-11
未找到文件。
app/controllers/registrations_controller.rb
浏览文件 @
7bb84e64
...
...
@@ -37,8 +37,8 @@ class RegistrationsController < Devise::RegistrationsController
super
end
def
after_sign_up_path_for
(
_resource
)
users_almost_there_path
def
after_sign_up_path_for
(
user
)
user
.
confirmed_at
.
present?
?
dashboard_projects_path
:
user
s_almost_there_path
end
def
after_inactive_sign_up_path_for
(
_resource
)
...
...
app/views/admin/application_settings/_form.html.haml
浏览文件 @
7bb84e64
...
...
@@ -106,9 +106,9 @@
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
=
f
.
label
:s
kip
_confirmation_email
do
=
f
.
label
:s
end_user
_confirmation_email
do
=
f
.
check_box
:send_user_confirmation_email
Send
sign-up email confirmation
Send
confirmation email on sign-up
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
...
...
db/migrate/20160421141709_add_send_confirmation_email_to_application_settings.rb
浏览文件 @
7bb84e64
...
...
@@ -3,7 +3,7 @@ class AddSendConfirmationEmailToApplicationSettings < ActiveRecord::Migration
add_column
:application_settings
,
:send_user_confirmation_email
,
:boolean
,
default:
false
#Sets confirmation email to true by default on existing installations.
ApplicationSetting
.
update_all
(
send_user_confirmation_email:
true
)
execute
"UPDATE application_settings SET send_user_confirmation_email=true"
end
def
down
...
...
doc/security/README.md
浏览文件 @
7bb84e64
...
...
@@ -8,3 +8,4 @@
-
[
User File Uploads
](
user_file_uploads.md
)
-
[
How we manage the CRIME vulnerability
](
crime_vulnerability.md
)
-
[
Enforce Two-factor authentication
](
two_factor_authentication.md
)
-
[
Send email confirmation on sign-up
](
user_email_confirmation.md
)
doc/security/user_email_confirmation.md
0 → 100644
浏览文件 @
7bb84e64
# User email confirmation at sign-up
Gitlab admin can enable email confirmation on sign-up, if you want to confirm all
user emails before they are able to sign-in.
In the Admin area under
**Settings**
(
`/admin/application_settings`
), go to section
**Sign-in Restrictions**
and look for
**Send confirmation email on sign-up**
option.
spec/controllers/registrations_controller_spec.rb
浏览文件 @
7bb84e64
...
...
@@ -16,7 +16,7 @@ describe RegistrationsController do
it
'logs user in directly'
do
post
(
:create
,
user_params
)
expect
(
ActionMailer
::
Base
.
deliveries
.
last
).
to
be_nil
expect
(
subject
.
current_user
).
to
be
expect
(
subject
.
current_user
).
to
_not
be_nil
end
end
...
...
spec/features/signup_spec.rb
浏览文件 @
7bb84e64
...
...
@@ -2,22 +2,45 @@ require 'spec_helper'
feature
'Signup'
,
feature:
true
do
describe
'signup with no errors'
do
before
{
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
it
'creates the user account and sends a confirmation email'
do
user
=
build
(
:user
)
context
"when sending confirmation email"
do
before
{
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
visit
root_path
it
'creates the user account and sends a confirmation email'
do
user
=
build
(
:user
)
fill_in
'new_user_name'
,
with:
user
.
name
fill_in
'new_user_username'
,
with:
user
.
username
fill_in
'new_user_email'
,
with:
user
.
email
fill_in
'new_user_password'
,
with:
user
.
password
click_button
"Sign up"
visit
root_path
fill_in
'new_user_name'
,
with:
user
.
name
fill_in
'new_user_username'
,
with:
user
.
username
fill_in
'new_user_email'
,
with:
user
.
email
fill_in
'new_user_password'
,
with:
user
.
password
click_button
"Sign up"
expect
(
current_path
).
to
eq
users_almost_there_path
expect
(
page
).
to
have_content
(
"Please check your email to confirm your account"
)
expect
(
current_path
).
to
eq
users_almost_there_path
expect
(
page
).
to
have_content
(
"Please check your email to confirm your account"
)
end
end
context
"when not sending confirmation email"
do
before
{
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
false
)
}
it
'creates the user account and goes to dashboard'
do
user
=
build
(
:user
)
visit
root_path
fill_in
'new_user_name'
,
with:
user
.
name
fill_in
'new_user_username'
,
with:
user
.
username
fill_in
'new_user_email'
,
with:
user
.
email
fill_in
'new_user_password'
,
with:
user
.
password
click_button
"Sign up"
expect
(
current_path
).
to
eq
dashboard_projects_path
expect
(
page
).
to
have_content
(
"Welcome! You have signed up successfully."
)
end
end
end
describe
'signup with errors'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录