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
Jérome Perrin
gitlab-ce
Commits
7bb84e64
Commit
7bb84e64
authored
May 06, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change landing page when skipping confirmation email and add documentation
parent
0baadd6c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
17 deletions
+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
No files found.
app/controllers/registrations_controller.rb
View file @
7bb84e64
...
@@ -37,8 +37,8 @@ class RegistrationsController < Devise::RegistrationsController
...
@@ -37,8 +37,8 @@ class RegistrationsController < Devise::RegistrationsController
super
super
end
end
def
after_sign_up_path_for
(
_resource
)
def
after_sign_up_path_for
(
user
)
users_almost_there_path
user
.
confirmed_at
.
present?
?
dashboard_projects_path
:
user
s_almost_there_path
end
end
def
after_inactive_sign_up_path_for
(
_resource
)
def
after_inactive_sign_up_path_for
(
_resource
)
...
...
app/views/admin/application_settings/_form.html.haml
View file @
7bb84e64
...
@@ -106,9 +106,9 @@
...
@@ -106,9 +106,9 @@
.form-group
.form-group
.col-sm-offset-2.col-sm-10
.col-sm-offset-2.col-sm-10
.checkbox
.checkbox
=
f
.
label
:s
kip
_confirmation_email
do
=
f
.
label
:s
end_user
_confirmation_email
do
=
f
.
check_box
:send_user_confirmation_email
=
f
.
check_box
:send_user_confirmation_email
Send
sign-up email confirmation
Send
confirmation email on sign-up
.form-group
.form-group
.col-sm-offset-2.col-sm-10
.col-sm-offset-2.col-sm-10
.checkbox
.checkbox
...
...
db/migrate/20160421141709_add_send_confirmation_email_to_application_settings.rb
View file @
7bb84e64
...
@@ -3,7 +3,7 @@ class AddSendConfirmationEmailToApplicationSettings < ActiveRecord::Migration
...
@@ -3,7 +3,7 @@ class AddSendConfirmationEmailToApplicationSettings < ActiveRecord::Migration
add_column
:application_settings
,
:send_user_confirmation_email
,
:boolean
,
default:
false
add_column
:application_settings
,
:send_user_confirmation_email
,
:boolean
,
default:
false
#Sets confirmation email to true by default on existing installations.
#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
end
def
down
def
down
...
...
doc/security/README.md
View file @
7bb84e64
...
@@ -8,3 +8,4 @@
...
@@ -8,3 +8,4 @@
-
[
User File Uploads
](
user_file_uploads.md
)
-
[
User File Uploads
](
user_file_uploads.md
)
-
[
How we manage the CRIME vulnerability
](
crime_vulnerability.md
)
-
[
How we manage the CRIME vulnerability
](
crime_vulnerability.md
)
-
[
Enforce Two-factor authentication
](
two_factor_authentication.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
View file @
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
View file @
7bb84e64
...
@@ -16,7 +16,7 @@ describe RegistrationsController do
...
@@ -16,7 +16,7 @@ describe RegistrationsController do
it
'logs user in directly'
do
it
'logs user in directly'
do
post
(
:create
,
user_params
)
post
(
:create
,
user_params
)
expect
(
ActionMailer
::
Base
.
deliveries
.
last
).
to
be_nil
expect
(
ActionMailer
::
Base
.
deliveries
.
last
).
to
be_nil
expect
(
subject
.
current_user
).
to
be
expect
(
subject
.
current_user
).
to
_not
be_nil
end
end
end
end
...
...
spec/features/signup_spec.rb
View file @
7bb84e64
...
@@ -2,6 +2,8 @@ require 'spec_helper'
...
@@ -2,6 +2,8 @@ require 'spec_helper'
feature
'Signup'
,
feature:
true
do
feature
'Signup'
,
feature:
true
do
describe
'signup with no errors'
do
describe
'signup with no errors'
do
context
"when sending confirmation email"
do
before
{
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
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
it
'creates the user account and sends a confirmation email'
do
...
@@ -20,6 +22,27 @@ feature 'Signup', feature: true do
...
@@ -20,6 +22,27 @@ feature 'Signup', feature: true do
end
end
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
describe
'signup with errors'
do
it
"displays the errors"
do
it
"displays the errors"
do
existing_user
=
create
(
:user
)
existing_user
=
create
(
:user
)
...
...
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