Sha256: 8adaf10d6e1afe0c6a02cfa521b709edab7cfb31ce8f62df9a5cb4dca7c28cb9

Contents?: true

Size: 998 Bytes

Versions: 4

Compression:

Stored size: 998 Bytes

Contents

require 'authn'

module ActiveModel::Model
  def self.included(base)
    base.class_eval do
      extend  ActiveModel::Naming
      extend  ActiveModel::Translation
      include ActiveModel::Validations
      include ActiveModel::Conversion
      include ActiveModel::SecurePassword
    end
  end

  def initialize(params={})
    params.each do |attr, value|
      self.public_send("#{attr}=", value)
    end if params
  end

  def persisted?
    false
  end
end

class Account
  include ActiveModel::Model
  include AuthN::Model
  has_secure_password
  attr_accessor :password_digest

  def self.password(password=nil)
    if password
      @password = password
    else
      @password
    end
  end

  def self.where(hash)
    account = if hash[:email] == "kurtis@example.com"
      Account.new(password: password, password_confirmation: password)
    end
    [account]
  end

  def id
    @id ||= rand(100000)
  end
end


class Controller
  include AuthN::Session
  attr_accessor :session
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authn-3.8.4 test/helper.rb
authn-3.7.4 test/helper.rb
authn-3.7.2 test/helper.rb
authn-3.5.0 test/helper.rb