Class: Tomify::Api::Public::PasswordsController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/tomify/api/public/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



2
3
4
5
6
7
8
9
10
# File 'app/controllers/tomify/api/public/passwords_controller.rb', line 2

def create
  if user = Tomify.models.user.find_by(email: params[:password][:email])
    user.activities.create(action: action_name, controller: controller_name)
    Tomify.mailers.user.reset_password(user).deliver_now
    render json: { type: :success, message: "Email Sent" }
  else
    render json: { type: :warning, message: "Email could not be found" }
  end
end