Sha256: 56490411b28c09e925076154d3dc5701eaa67262f79bbfe362ba1f18da1962d1

Contents?: true

Size: 790 Bytes

Versions: 9

Compression:

Stored size: 790 Bytes

Contents

require 'rubygems'
require 'bundler/setup'
require 'mongo_mapper'
require 'entrance'

MongoMapper.connection = Mongo::Connection.new('localhost')
MongoMapper.database   = 'entrance-omniauth-example'

Entrance.configure do |config|
  config.remember_for  = 1.month
  config.cookie_secure = false # for testing
end

class User
  include MongoMapper::Document
  include Entrance::Model

  key :state, :default => 'active'

  key :name
  key :email, :unique => true

  key :password_hash, String
  key :auth_provider, String
  key :auth_uid, String

  key :remember_token
  key :remember_token_expires_at, Time

  ensure_index [[:auth_provider, 1], [:auth_uid, -1]], :unique => true

  provides_entrance :local => false, :remote => true

  def can_login?
    state.to_sym == :active
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
entrance-0.6.4 examples/sinatra-omniauth/app/models.rb
entrance-0.6.3 examples/sinatra-omniauth/app/models.rb
entrance-0.6.2 examples/sinatra-omniauth/app/models.rb
entrance-0.6.1 examples/sinatra-omniauth/app/models.rb
entrance-0.6.0 examples/sinatra-omniauth/app/models.rb
entrance-0.5.3 examples/sinatra-omniauth/app/models.rb
entrance-0.5.2 examples/sinatra-omniauth/app/models.rb
entrance-0.5.1 examples/sinatra-omniauth/app/models.rb
entrance-0.5.0 examples/sinatra-omniauth/app/models.rb