diff options
author | George Andrinopoulos <geoandri@gmail.com> | 2017-03-27 09:37:24 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-03-27 09:37:24 +0000 |
commit | 7c74a0209b2354ee9260bfebe9bbde5cd0c141bf (patch) | |
tree | f98ebab7adf9ca90ab7128c4f9e9605d84b13ae9 /app/controllers/registrations_controller.rb | |
parent | e19d4c511d21e14d2442546a5d00c5fbdf13308a (diff) | |
download | gitlab-ce-7c74a0209b2354ee9260bfebe9bbde5cd0c141bf.tar.gz |
Implement new service for creating user
Diffstat (limited to 'app/controllers/registrations_controller.rb')
-rw-r--r-- | app/controllers/registrations_controller.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index b44f38d4a0c..a49a1f50a81 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -1,5 +1,4 @@ class RegistrationsController < Devise::RegistrationsController - before_action :signup_enabled? include Recaptcha::Verify def new @@ -21,6 +20,8 @@ class RegistrationsController < Devise::RegistrationsController flash.delete :recaptcha_error render action: 'new' end + rescue Gitlab::Access::AccessDeniedError + redirect_to(new_user_session_path) end def destroy @@ -50,12 +51,6 @@ class RegistrationsController < Devise::RegistrationsController private - def signup_enabled? - unless current_application_settings.signup_enabled? - redirect_to(new_user_session_path) - end - end - def sign_up_params params.require(:user).permit(:username, :email, :email_confirmation, :name, :password) end @@ -65,7 +60,7 @@ class RegistrationsController < Devise::RegistrationsController end def resource - @resource ||= User.new(sign_up_params) + @resource ||= Users::CreateService.new(current_user, sign_up_params).build end def devise_mapping |