Sha256: e0d8dfdb48947ab8b5282e2a9f6d6644302b8e85883dea13ff67cbbcefc45bc0
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
module Locomotive module Concerns module TokenAuthenticationController extend ActiveSupport::Concern included do before_action :unsafe_token_authentication_params def find_record_from_identifier(entity) if Locomotive.config.unsafe_token_authentication Locomotive::Account.where(authentication_token: params[:locomotive_account_token]).first else super end end end private def unsafe_token_authentication_params if Locomotive.config.unsafe_token_authentication params[:locomotive_account_token] = params[:auth_token] params[:locomotive_account_email] = Locomotive::Account.where(authentication_token: params[:auth_token]).first.try(:email) end end public module ClassMethods def account_required(options = {}) class_eval do acts_as_token_authentication_handler_for Locomotive::Account if actions = options[:except] skip_before_action :authenticate_locomotive_account_from_token!, only: :create end end end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems