2025-01-07 18:09:44 +08:00
|
|
|
class PasswordResetsController < ApplicationController
|
|
|
|
def new
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2025-01-08 10:14:36 +08:00
|
|
|
@user = User.find_by(email: params[:password_reset][:email].downcase)
|
2025-01-07 18:09:44 +08:00
|
|
|
if @user
|
|
|
|
@user.create_reset_digest
|
|
|
|
@user.send_password_reset_email
|
|
|
|
flash[:info] = "Email send with password reset instructions"
|
|
|
|
redirect_to root_url
|
|
|
|
else
|
|
|
|
flash.now[:danger] = "Email not found"
|
2025-01-08 10:14:36 +08:00
|
|
|
render 'new', status: :unprocessable_entity
|
2025-01-07 18:09:44 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
end
|
|
|
|
end
|