Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
4f9308da
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,体验更适合开发者的 AI 搜索 >>
提交
4f9308da
编写于
3月 11, 2020
作者:
G
GitLab Release Tools Bot
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'dev/12-8-stable' into 12-8-stable
上级
173c84f3
5fc76a64
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
149 addition
and
41 deletion
+149
-41
CHANGELOG.md
CHANGELOG.md
+7
-0
GITALY_SERVER_VERSION
GITALY_SERVER_VERSION
+1
-1
VERSION
VERSION
+1
-1
app/controllers/concerns/confirm_email_warning.rb
app/controllers/concerns/confirm_email_warning.rb
+1
-1
app/controllers/confirmations_controller.rb
app/controllers/confirmations_controller.rb
+2
-0
app/controllers/registrations_controller.rb
app/controllers/registrations_controller.rb
+18
-8
app/models/user.rb
app/models/user.rb
+7
-0
spec/controllers/concerns/confirm_email_warning_spec.rb
spec/controllers/concerns/confirm_email_warning_spec.rb
+4
-0
spec/controllers/registrations_controller_spec.rb
spec/controllers/registrations_controller_spec.rb
+10
-8
spec/features/invites_spec.rb
spec/features/invites_spec.rb
+46
-5
spec/features/users/login_spec.rb
spec/features/users/login_spec.rb
+1
-0
spec/features/users/signup_spec.rb
spec/features/users/signup_spec.rb
+51
-17
未找到文件。
CHANGELOG.md
浏览文件 @
4f9308da
...
...
@@ -2,6 +2,13 @@
documentation](doc/development/changelog.md) for instructions on adding your own
entry.
## 12.8.6 (2020-03-11)
### Security (1 change)
- Do not enable soft email confirmation by default.
## 12.8.5
### Fixed (8 changes)
...
...
GITALY_SERVER_VERSION
浏览文件 @
4f9308da
12.8.
5
12.8.
6
VERSION
浏览文件 @
4f9308da
12.8.
5
12.8.
6
app/controllers/concerns/confirm_email_warning.rb
浏览文件 @
4f9308da
...
...
@@ -10,7 +10,7 @@ module ConfirmEmailWarning
protected
def
show_confirm_warning?
html_request?
&&
request
.
get?
html_request?
&&
request
.
get?
&&
Feature
.
enabled?
(
:soft_email_confirmation
)
end
def
set_confirm_warning
...
...
app/controllers/confirmations_controller.rb
浏览文件 @
4f9308da
...
...
@@ -11,6 +11,8 @@ class ConfirmationsController < Devise::ConfirmationsController
protected
def
after_resending_confirmation_instructions_path_for
(
resource
)
return
users_almost_there_path
unless
Feature
.
enabled?
(
:soft_email_confirmation
)
stored_location_for
(
resource
)
||
dashboard_projects_path
end
...
...
app/controllers/registrations_controller.rb
浏览文件 @
4f9308da
...
...
@@ -54,7 +54,7 @@ class RegistrationsController < Devise::RegistrationsController
def
welcome
return
redirect_to
new_user_registration_path
unless
current_user
return
redirect_to
stored_location_or_dashboard
(
current_user
)
if
current_user
.
role
.
present?
&&
!
current_user
.
setup_for_company
.
nil?
return
redirect_to
path_for_signed_in_user
(
current_user
)
if
current_user
.
role
.
present?
&&
!
current_user
.
setup_for_company
.
nil?
end
def
update_registration
...
...
@@ -64,7 +64,7 @@ class RegistrationsController < Devise::RegistrationsController
if
result
[
:status
]
==
:success
track_experiment_event
(
:signup_flow
,
'end'
)
# We want this event to be tracked when the user is _in_ the experimental group
set_flash_message!
:notice
,
:signed_up
redirect_to
stored_location_or_dashboard
(
current_user
)
redirect_to
path_for_signed_in_user
(
current_user
)
else
render
:welcome
end
...
...
@@ -111,14 +111,12 @@ class RegistrationsController < Devise::RegistrationsController
return
users_sign_up_welcome_path
if
experiment_enabled?
(
:signup_flow
)
stored_location_or_dashboard
(
user
)
path_for_signed_in_user
(
user
)
end
def
after_inactive_sign_up_path_for
(
resource
)
# With the current `allow_unconfirmed_access_for` Devise setting in config/initializers/8_devise.rb,
# this method is never called. Leaving this here in case that value is set to 0.
Gitlab
::
AppLogger
.
info
(
user_created_message
)
users_almost_there_path
Feature
.
enabled?
(
:soft_email_confirmation
)
?
dashboard_projects_path
:
users_almost_there_path
end
private
...
...
@@ -180,8 +178,20 @@ class RegistrationsController < Devise::RegistrationsController
Gitlab
::
Utils
.
to_boolean
(
params
[
:terms_opt_in
])
end
def
stored_location_or_dashboard
(
user
)
stored_location_for
(
user
)
||
dashboard_projects_path
def
path_for_signed_in_user
(
user
)
if
requires_confirmation?
(
user
)
users_almost_there_path
else
stored_location_for
(
user
)
||
dashboard_projects_path
end
end
def
requires_confirmation?
(
user
)
return
false
if
user
.
confirmed?
return
false
if
Feature
.
enabled?
(
:soft_email_confirmation
)
return
false
if
experiment_enabled?
(
:signup_flow
)
true
end
def
load_recaptcha
...
...
app/models/user.rb
浏览文件 @
4f9308da
...
...
@@ -1670,6 +1670,13 @@ class User < ApplicationRecord
super
end
# override from Devise::Confirmable
def
confirmation_period_valid?
return
false
if
Feature
.
disabled?
(
:soft_email_confirmation
)
super
end
private
def
default_private_profile_to_false
...
...
spec/controllers/concerns/confirm_email_warning_spec.rb
浏览文件 @
4f9308da
...
...
@@ -3,6 +3,10 @@
require
'spec_helper'
describe
ConfirmEmailWarning
do
before
do
stub_feature_flags
(
soft_email_confirmation:
true
)
end
controller
(
ApplicationController
)
do
# `described_class` is not available in this context
include
ConfirmEmailWarning
...
...
spec/controllers/registrations_controller_spec.rb
浏览文件 @
4f9308da
...
...
@@ -79,29 +79,31 @@ describe RegistrationsController do
stub_application_setting
(
send_user_confirmation_email:
true
)
end
context
'when
a grace period is active for confirming the email address
'
do
context
'when
soft email confirmation is not enabled
'
do
before
do
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
2
.
days
stub_feature_flags
(
soft_email_confirmation:
false
)
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
0
end
it
'
sends a confirmation email and redirects to the dashboard
'
do
it
'
does not authenticate the user and sends a confirmation email
'
do
post
(
:create
,
params:
user_params
)
expect
(
ActionMailer
::
Base
.
deliveries
.
last
.
to
.
first
).
to
eq
(
user_params
[
:user
][
:email
])
expect
(
response
).
to
redirect_to
(
dashboard_projects_path
)
expect
(
subject
.
current_user
).
to
be_nil
end
end
context
'when
no grace period is active for confirming the email address
'
do
context
'when
soft email confirmation is enabled
'
do
before
do
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
0
stub_feature_flags
(
soft_email_confirmation:
true
)
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
2
.
days
end
it
'
sends a confirmation email and redirects to the almost there page
'
do
it
'
authenticates the user and sends a confirmation email
'
do
post
(
:create
,
params:
user_params
)
expect
(
ActionMailer
::
Base
.
deliveries
.
last
.
to
.
first
).
to
eq
(
user_params
[
:user
][
:email
])
expect
(
response
).
to
redirect_to
(
users_almost_there
_path
)
expect
(
response
).
to
redirect_to
(
dashboard_projects
_path
)
end
end
end
...
...
spec/features/invites_spec.rb
浏览文件 @
4f9308da
...
...
@@ -135,7 +135,9 @@ describe 'Invites' do
expect
(
current_path
).
to
eq
(
dashboard_projects_path
)
expect
(
page
).
to
have_content
(
project
.
full_name
)
visit
group_path
(
group
)
expect
(
page
).
to
have_content
(
group
.
full_name
)
end
...
...
@@ -153,6 +155,25 @@ describe 'Invites' do
context
'email confirmation enabled'
do
let
(
:send_email_confirmation
)
{
true
}
context
'when soft email confirmation is not enabled'
do
before
do
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
0
end
it
'signs up and redirects to root page with all the project/groups invitation automatically accepted'
do
fill_in_sign_up_form
(
new_user
)
confirm_email
(
new_user
)
fill_in_sign_in_form
(
new_user
)
expect
(
current_path
).
to
eq
(
root_path
)
expect
(
page
).
to
have_content
(
project
.
full_name
)
visit
group_path
(
group
)
expect
(
page
).
to
have_content
(
group
.
full_name
)
end
end
context
'when soft email confirmation is enabled'
do
before
do
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
2
.
days
...
...
@@ -164,7 +185,9 @@ describe 'Invites' do
expect
(
current_path
).
to
eq
(
root_path
)
expect
(
page
).
to
have_content
(
project
.
full_name
)
visit
group_path
(
group
)
expect
(
page
).
to
have_content
(
group
.
full_name
)
end
end
...
...
@@ -180,14 +203,32 @@ describe 'Invites' do
context
'the user sign-up using a different email address'
do
let
(
:invite_email
)
{
build_stubbed
(
:user
).
email
}
before
do
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
2
.
days
context
'when soft email confirmation is not enabled'
do
before
do
stub_feature_flags
(
soft_email_confirmation:
false
)
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
0
end
it
'signs up and redirects to the invitation page'
do
fill_in_sign_up_form
(
new_user
)
confirm_email
(
new_user
)
fill_in_sign_in_form
(
new_user
)
expect
(
current_path
).
to
eq
(
invite_path
(
group_invite
.
raw_invite_token
))
end
end
it
'signs up and redirects to the invitation page'
do
fill_in_sign_up_form
(
new_user
)
context
'when soft email confirmation is enabled'
do
before
do
stub_feature_flags
(
soft_email_confirmation:
true
)
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
2
.
days
end
expect
(
current_path
).
to
eq
(
invite_path
(
group_invite
.
raw_invite_token
))
it
'signs up and redirects to the invitation page'
do
fill_in_sign_up_form
(
new_user
)
expect
(
current_path
).
to
eq
(
invite_path
(
group_invite
.
raw_invite_token
))
end
end
end
end
...
...
spec/features/users/login_spec.rb
浏览文件 @
4f9308da
...
...
@@ -797,6 +797,7 @@ describe 'Login' do
before
do
stub_application_setting
(
send_user_confirmation_email:
true
)
stub_feature_flags
(
soft_email_confirmation:
true
)
allow
(
User
).
to
receive
(
:allow_unconfirmed_access_for
).
and_return
grace_period
end
...
...
spec/features/users/signup_spec.rb
浏览文件 @
4f9308da
...
...
@@ -129,29 +129,63 @@ shared_examples 'Signup' do
stub_application_setting
(
send_user_confirmation_email:
true
)
end
it
'creates the user account and sends a confirmation email'
do
visit
new_user_registration_path
context
'when soft email confirmation is not enabled'
do
before
do
stub_feature_flags
(
soft_email_confirmation:
false
)
end
fill_in
'new_user_username'
,
with:
new_user
.
username
fill_in
'new_user_email'
,
with:
new_user
.
email
it
'creates the user account and sends a confirmation email'
do
visit
new_user_registration_path
if
Gitlab
::
Experimentation
.
enabled?
(
:signup_flow
)
fill_in
'new_user_first_name'
,
with:
new_user
.
first_name
fill_in
'new_user_last_name'
,
with:
new_user
.
last_name
else
fill_in
'new_user_name'
,
with:
new_user
.
name
fill_in
'new_user_email_confirmation'
,
with:
new_user
.
email
fill_in
'new_user_username'
,
with:
new_user
.
username
fill_in
'new_user_email'
,
with:
new_user
.
email
if
Gitlab
::
Experimentation
.
enabled?
(
:signup_flow
)
fill_in
'new_user_first_name'
,
with:
new_user
.
first_name
fill_in
'new_user_last_name'
,
with:
new_user
.
last_name
else
fill_in
'new_user_name'
,
with:
new_user
.
name
fill_in
'new_user_email_confirmation'
,
with:
new_user
.
email
end
fill_in
'new_user_password'
,
with:
new_user
.
password
expect
{
click_button
'Register'
}.
to
change
{
User
.
count
}.
by
(
1
)
expect
(
current_path
).
to
eq
users_almost_there_path
expect
(
page
).
to
have_content
(
'Please check your email to confirm your account'
)
end
end
fill_in
'new_user_password'
,
with:
new_user
.
password
context
'when soft email confirmation is enabled'
do
before
do
stub_feature_flags
(
soft_email_confirmation:
true
)
end
expect
{
click_button
'Register'
}.
to
change
{
User
.
count
}.
by
(
1
)
it
'creates the user account and sends a confirmation email'
do
visit
new_user_registration_path
if
Gitlab
::
Experimentation
.
enabled?
(
:signup_flow
)
expect
(
current_path
).
to
eq
users_sign_up_welcome_path
else
expect
(
current_path
).
to
eq
dashboard_projects_path
expect
(
page
).
to
have_content
(
"Please check your email (
#{
new_user
.
email
}
) to verify that you own this address and unlock the power of CI/CD."
)
fill_in
'new_user_username'
,
with:
new_user
.
username
fill_in
'new_user_email'
,
with:
new_user
.
email
if
Gitlab
::
Experimentation
.
enabled?
(
:signup_flow
)
fill_in
'new_user_first_name'
,
with:
new_user
.
first_name
fill_in
'new_user_last_name'
,
with:
new_user
.
last_name
else
fill_in
'new_user_name'
,
with:
new_user
.
name
fill_in
'new_user_email_confirmation'
,
with:
new_user
.
email
end
fill_in
'new_user_password'
,
with:
new_user
.
password
expect
{
click_button
'Register'
}.
to
change
{
User
.
count
}.
by
(
1
)
if
Gitlab
::
Experimentation
.
enabled?
(
:signup_flow
)
expect
(
current_path
).
to
eq
users_sign_up_welcome_path
else
expect
(
current_path
).
to
eq
dashboard_projects_path
expect
(
page
).
to
have_content
(
"Please check your email (
#{
new_user
.
email
}
) to verify that you own this address and unlock the power of CI/CD."
)
end
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录