Permalink
Browse files

Updated to Devise 2.1

  • Loading branch information...
1 parent f599771 commit c3e42161a8ec23ce32f7710694f43097b80a9c71 @pollingj pollingj committed May 17, 2012
View
@@ -5,3 +5,4 @@ pkg
log
*.gem
*.lock
+.rvmrc
View
17 Gemfile
@@ -2,24 +2,27 @@ source :rubygems
group :test do
gem "test-unit", "~> 2.0.9"
- gem "webrat", "~> 0.7.2"
+ gem "webrat", "~> 0.7.0"
gem "mocha", "~> 0.9.8", :require => false
end
group :default do
- gem "rails", "~> 3.0.7"
- gem "webrat", "~> 0.7.2"
+ gem "rails", "~> 3.2.0"
+ gem "webrat", "~> 0.7.0"
- gem 'mongo_mapper', '~> 0.9.0'
+ gem 'mongo_mapper', '~> 0.11.0'
gem 'sugar-high', '~> 0.4.3'
- gem 'devise', '>= 1.2.0'
+ gem 'devise', '>= 2.1.0'
+ gem 'devise-encryptable'
# gem 'rails3-generators', '>= 0.14.0'
gem 'bson_ext', '>= 1.2.0'
gem 'rake', '>= 0.8.7'
gem "orm_adapter"
- gem "oa-oauth", '~> 0.2.0', :require => "omniauth/oauth"
- gem "oa-openid", '~> 0.2.0', :require => "omniauth/openid"
+ #gem "oa-oauth", '~> 0.3.0', :require => "omniauth/oauth"
+ #gem "oa-openid", '~> 0.3.0', :require => "omniauth/openid"
+ gem "omniauth-openid", '~>1.0.0'
+ gem "omniauth-facebook", '~>1.2.0'
platforms :mri_18 do
gem "SystemTimer"
@@ -1,37 +1,5 @@
require 'orm_adapter/adapters/mongo_mapper'
-module Devise
- module Orm
- module MongoMapper
- extend ActiveSupport::Concern
+#MongoMapper::Document.plugin Devise::Orm::MongoMapper
+MongoMapper::Document::ClassMethods.send :include, Devise::Models
- included do
- extend Devise::Models
- extend Devise::Orm::MongoMapper::Hook
- end
-
- module Hook
- def devise_modules_hook!
- extend Schema
- yield
- return unless Devise.apply_schema
- devise_modules.each { |m| send(m) if respond_to?(m, true) }
- end
-
- end
-
- module Schema
- include Devise::Schema
-
- # Tell how to apply schema methods
- def apply_devise_schema(name, type, options={})
- type = Time if type == DateTime
- key(name, type, options)
- end
- end
-
- end
- end
-end
-
-MongoMapper::Document.plugin Devise::Orm::MongoMapper
@@ -5,6 +5,25 @@ class Admin
include Shim
include SharedAdmin
- key :remember_token, String
+ ## Database authenticatable
+ key :email, String, :null => true
+ key :encrypted_password, String, :null => true
+
+ ## Recoverable
+ key :reset_password_token, String
+ key :reset_password_sent_at, Time
+
+ ## Rememberable
+ key :remember_created_at, Time
+
+ ## Confirmable
+ key :confirmation_token, String
+ key :confirmed_at, Time
+ key :confirmation_sent_at, Time
+ key :unconfirmed_email, String
+
+ ## Lockable
+ key :locked_at, Time
+
timestamps!
end
@@ -4,4 +4,21 @@ module Shim
included do
self.include_root_in_json = true
end
+ #
+
+ module ClassMethods
+ def last(options={})
+ options.delete(:order) if options[:order] == "id"
+ super(options)
+ end
+
+ def find_by_email(email)
+ first(:conditions => { :email => email })
+ end
+ end
+
+ # overwrite equality (because some devise tests use this for asserting model equality)
+ def ==(other)
+ other.is_a?(self.class) && _id == other._id
+ end
end
@@ -7,5 +7,37 @@ class User
key :username, String
key :facebook_token, String
+
+ ## Database authenticatable
+ key :email, String, :null => false, :default => ""
+ key :encrypted_password, String, :null => false, :default => ""
+
+ ## Recoverable
+ key :reset_password_token, String
+ key :reset_password_sent_at, Time
+
+ ## Rememberable
+ key :remember_created_at, Time
+
+ ## Trackable
+ key :sign_in_count, Integer, :default => 0
+ key :current_sign_in_at, Time
+ key :last_sign_in_at, Time
+ key :current_sign_in_ip, String
+ key :last_sign_in_ip, String
+
+ ## Confirmable
+ key :confirmation_token, String
+ key :confirmed_at, Time
+ key :confirmation_sent_at, Time
+
+ ## Lockable
+ key :failed_attempts, Integer, :default => 0
+ key :locked_at, Time
+ key :unlock_token, String
+
+ ## Token authenticatable
+ key :authentication_token, String
+
timestamps!
end

0 comments on commit c3e4216

Please sign in to comment.