lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt in authentication-zero-2.1.1 vs lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt in authentication-zero-2.2.1
- old
+ new
@@ -1,7 +1,7 @@
class RegistrationsController < ApplicationController
- skip_before_action :authenticate
+ skip_before_action :authenticate, only: %i[ new create ]
def new
@<%= singular_table_name %> = <%= class_name %>.new
end
@@ -11,9 +11,14 @@
if @<%= singular_table_name %>.save
redirect_to sign_in_path, notice: "Welcome! You have signed up successfully"
else
render :new, status: :unprocessable_entity
end
+ end
+
+ def destroy
+ Current.<%= singular_table_name %>.destroy
+ redirect_to sign_in_path, notice: "Your account is closed"
end
private
def <%= "#{singular_table_name}_params" %>
params.require(:<%= singular_table_name %>).permit(:email, :password, :password_confirmation)