lib/generators/authentication/templates/controllers/html/passwords_controller.rb.tt in authentication-zero-0.0.12 vs lib/generators/authentication/templates/controllers/html/passwords_controller.rb.tt in authentication-zero-0.0.13
- old
+ new
@@ -1,16 +1,16 @@
class PasswordsController < ApplicationController
before_action :set_<%= singular_table_name %>
def edit
- @<%= singular_table_name %> = Current.<%= singular_table_name %>
end
def update
if !@<%= singular_table_name %>.authenticate(params[:current_password])
redirect_to edit_passwords_path, alert: "The current password you entered is incorrect"
- elsif @<%= singular_table_name %>.update(password_params)
+ elsif @<%= singular_table_name %>.update(<%= "#{singular_table_name}_params" %>)
+ PasswordMailer.with(user: @<%= singular_table_name %>).changed.deliver_later
redirect_to root_path, notice: "Your password has been changed successfully"
else
render :edit, status: :unprocessable_entity
end
end
@@ -18,9 +18,9 @@
private
def set_<%= singular_table_name %>
@<%= singular_table_name %> = Current.<%= singular_table_name %>
end
- def password_params
+ def <%= "#{singular_table_name}_params" %>
params.require(:<%= singular_table_name %>).permit(:password, :password_confirmation)
end
end