Class: Magics::SignInsController

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

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/action_auth/magics/sign_ins_controller.rb', line 3

def show
  user = ActionAuth::User.find_by_token_for(:magic_token, params[:token])
  if user
    @session = user.sessions.create
    cookies.signed.permanent[:session_token] = { value: @session.id, httponly: true }
    user.update(verified: true)
    redirect_to main_app.root_path, notice: "Signed In"
  else
    redirect_to , alert: "Authentication failed, please try again."
  end
end