mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Small cleanup.
This commit is contained in:
parent
a6a018253e
commit
22e1fa0cb9
4 changed files with 10 additions and 19 deletions
|
@ -79,7 +79,7 @@ module Devise
|
|||
|
||||
def save(options=nil)
|
||||
if options.is_a?(Hash) && options[:validate] == false
|
||||
save
|
||||
save!
|
||||
else
|
||||
super()
|
||||
end
|
||||
|
@ -88,10 +88,6 @@ module Devise
|
|||
def update_attributes(*args)
|
||||
update(*args)
|
||||
end
|
||||
|
||||
def lock!
|
||||
self.reload
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module Devise
|
||||
module Orm
|
||||
module Mongoid
|
||||
|
||||
module Hook
|
||||
def devise_modules_hook!
|
||||
extend Schema
|
||||
|
@ -19,15 +18,11 @@ module Devise
|
|||
# Tell how to apply schema methods
|
||||
def apply_schema(name, type, options={})
|
||||
type = Time if type == DateTime
|
||||
field name, {:type => type}.merge(options)
|
||||
field name, { :type => type }.merge(options)
|
||||
end
|
||||
end
|
||||
|
||||
module Compatibility
|
||||
def lock!
|
||||
self.reload
|
||||
end
|
||||
|
||||
def save(validate = true)
|
||||
if validate.is_a?(Hash) && validate.has_key?(:validate)
|
||||
validate = validate[:validate]
|
||||
|
@ -39,9 +34,7 @@ module Devise
|
|||
end
|
||||
end
|
||||
|
||||
[Mongoid::Document].each do |mod|
|
||||
mod::ClassMethods.class_eval do
|
||||
include Devise::Models
|
||||
include Devise::Orm::Mongoid::Hook
|
||||
end
|
||||
Mongoid::Document::ClassMethods.class_eval do
|
||||
include Devise::Models
|
||||
include Devise::Orm::Mongoid::Hook
|
||||
end
|
|
@ -1,12 +1,12 @@
|
|||
class DeviseCreate<%= table_name.camelize %> < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table(:<%= table_name %>) do |t|
|
||||
t.database_authenticatable :encryptor => :<%= Devise.encryptor %>, :null => false
|
||||
t.database_authenticatable :null => false
|
||||
t.confirmable
|
||||
t.recoverable
|
||||
t.rememberable
|
||||
t.trackable
|
||||
# t.lockable
|
||||
# t.lockable :unlock_strategy => :<%= Devise.unlock_strategy %>
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
|
|
@ -81,7 +81,9 @@ class LockTest < ActionController::IntegrationTest
|
|||
|
||||
test "user should not send a new e-mail if already locked" do
|
||||
user = create_user(:locked => true)
|
||||
user.update_attribute(:failed_attempts, User.maximum_attempts + 1)
|
||||
user.failed_attempts = User.maximum_attempts + 1
|
||||
user.save!
|
||||
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
sign_in_as_user(:password => "invalid")
|
||||
|
|
Loading…
Add table
Reference in a new issue