def show
      # Make it "slow" on purpose to make brute-force attacks more of a hassle
      BCrypt::Password.create(params[:token])

      session = find_session

      session.claim! if Passwordless.restrict_token_reuse

      raise SessionTimedOutError if session.timed_out?

      sign_in session.authenticatable

      redirect_enabled = Passwordless.redirect_back_after_sign_in
      destination = reset_passwordless_redirect_location!(User)

      if redirect_enabled && destination
        redirect_to destination
      else
        redirect_to main_app.root_path
      end
    rescue Session::TokenAlreadyClaimedError
      flash[:error] = I18n.t(".passwordless.sessions.create.token_claimed")
      redirect_to main_app.root_path
    rescue SessionTimedOutError
      flash[:error] = I18n.t(".passwordless.sessions.create.session_expired")
      redirect_to main_app.root_path
    end
def show
      # Make it "slow" on purpose to make brute-force attacks more of a hassle
      BCrypt::Password.create(params[:token])

      session = find_session

      session.claim! if Passwordless.restrict_token_reuse

      raise SessionTimedOutError if session.timed_out?

      sign_in session.authenticatable

      redirect_enabled = Passwordless.redirect_back_after_sign_in
      destination = reset_passwordless_redirect_location!(User)

      if redirect_enabled && destination
        redirect_to destination
      else
        redirect_to main_app.root_path
      end
    rescue Session::TokenAlreadyClaimedError
      flash[:error] = I18n.t(".passwordless.sessions.create.token_claimed")
      redirect_to main_app.root_path
    rescue SessionTimedOutError
      flash[:error] = I18n.t(".passwordless.sessions.create.session_expired")
      redirect_to main_app.root_path
    end
get '/sign_in/:token'
   Looks up session record by provided token. Signs in user if a match
   is found. Redirects to either the user's original destination
   or _root_path_
 @see ControllerHelpers#sign_in
 @see ControllerHelpers#save_passwordless_redirect_location!