Class: Groovestack::Auth::Passwordless::MagicLinksController

Inherits:
DeviseController
  • Object
show all
Defined in:
app/controllers/groovestack/auth/passwordless/magic_links_controller.rb

Instance Method Summary collapse

Instance Method Details

#show {|resource| ... } ⇒ Object

Yields:

  • (resource)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/groovestack/auth/passwordless/magic_links_controller.rb', line 12

def show
  self.resource = warden.authenticate!(auth_options)

  begin
    unless resource.confirmed?
      resource.skip_confirmation_notification! # skip sending confirmation email
      resource.confirm
    end
  rescue StandardError => e
    msg = "Passwordless Magic Link Confirmation Failure: #{e}"
    ::Groovestack::Base.notify_error(e.class, msg)
  end

  set_flash_message!(:notice, :signed_in)
  (resource_name, resource, event: :authentication)
  yield resource if block_given?

  respond_to do |format|
    format.html { redirect_to (resource) }
    format.json { render json: { success: true, resource: resource.as_json, status: :ok } }
  end
end