Class: Magics::RequestsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/action_auth/magics/requests_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/action_auth/magics/requests_controller.rb', line 6

def create
  user = User.find_or_initialize_by(email: params[:email])
  if user.new_record?
    password = SecureRandom.hex(32)
    user.password = password
    user.password_confirmation = password
    user.save!
  end

  UserMailer.with(user: user).magic_link.deliver_later

  redirect_to , notice: "Check your email for a magic link."
end

#newObject



3
4
# File 'app/controllers/action_auth/magics/requests_controller.rb', line 3

def new
end