Class: RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Includes:
Recaptcha::Verify
Defined in:
app/controllers/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/registrations_controller.rb', line 9

def create
  if !Gitlab::Recaptcha.load_configurations! || verify_recaptcha
    # To avoid duplicate form fields on the login page, the registration form
    # names fields using `new_user`, but Devise still wants the params in
    # `user`.
    if params["new_#{resource_name}"].present? && params[resource_name].blank?
      params[resource_name] = params.delete(:"new_#{resource_name}")
    end

    super
  else
    flash[:alert] = "There was an error with the reCAPTCHA code below. Please re-enter the code."
    flash.delete :recaptcha_error
    render action: 'new'
  end
end

#destroyObject


26
27
28
29
30
31
32
# File 'app/controllers/registrations_controller.rb', line 26

def destroy
  DeleteUserService.new(current_user).execute(current_user)

  respond_to do |format|
    format.html { redirect_to new_user_session_path, notice: "Account successfully removed." }
  end
end

#newObject


5
6
7
# File 'app/controllers/registrations_controller.rb', line 5

def new
  redirect_to(new_user_session_path)
end