diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-01-04 14:44:10 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-01-04 14:44:10 +0000 |
commit | ce4258e991b6db0e400538bccf21ea10c4bc7b3a (patch) | |
tree | 2350bbe22adae6c36f8e5ec67871a0dfe56b9f10 /app | |
parent | 71a692c16db2aacd1dcbb55542e64ee269939feb (diff) | |
parent | 33b41bc8a821974d07d01ffdee98db35d1df4840 (diff) | |
download | gitlab-ce-ce4258e991b6db0e400538bccf21ea10c4bc7b3a.tar.gz |
Merge branch 'add_email_password_confirmation' into 'master'
Add email confirmation field to registration form
Closes #3053
See merge request !7432
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/registrations_controller.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 1 | ||||
-rw-r--r-- | app/views/devise/shared/_signup_box.html.haml | 3 |
3 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index c45196cc3e9..5e652ebe27d 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -57,7 +57,7 @@ class RegistrationsController < Devise::RegistrationsController end def sign_up_params - params.require(:user).permit(:username, :email, :name, :password, :password_confirmation) + params.require(:user).permit(:username, :email, :email_confirmation, :name, :password) end def resource_name diff --git a/app/models/user.rb b/app/models/user.rb index e719c52836a..66a768d54bb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -99,6 +99,7 @@ class User < ActiveRecord::Base # # Note: devise :validatable above adds validations for :email and :password validates :name, presence: true + validates_confirmation_of :email validates :notification_email, presence: true validates :notification_email, email: true, if: ->(user) { user.notification_email != user.email } validates :public_email, presence: true, uniqueness: true, email: true, allow_blank: true diff --git a/app/views/devise/shared/_signup_box.html.haml b/app/views/devise/shared/_signup_box.html.haml index 545a938f4be..681eb303b49 100644 --- a/app/views/devise/shared/_signup_box.html.haml +++ b/app/views/devise/shared/_signup_box.html.haml @@ -15,6 +15,9 @@ .form-group = f.label :email = f.email_field :email, class: "form-control middle", required: true, title: "Please provide a valid email address." + %div.form-group + = f.label :email_confirmation + = f.email_field :email_confirmation, class: "form-control middle", required: true, title: "Please retype the email address." .form-group.append-bottom-20#password-strength = f.label :password = f.password_field :password, class: "form-control bottom", required: true, pattern: ".{#{@minimum_password_length},}", title: "Minimum length is #{@minimum_password_length} characters." |