1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Merge branch 'master' of git://github.com/plataformatec/devise

This commit is contained in:
José Valim 2009-10-20 18:06:31 -02:00
commit b3f68ab287
2 changed files with 9 additions and 8 deletions

View file

@ -3,7 +3,8 @@ module Devise
# Shortcut method for including all devise modules inside your model.
# You can give some extra options while declaring devise in your model:
#
# * except: let's you add all devise modules, except the ones you setup here:
# * except: convenient option that allows you to add all devise modules,
# removing only the modules you setup here:
#
# devise :all, :except => :rememberable
#
@ -17,7 +18,7 @@ module Devise
# devise :all, :stretches => 20
#
# You can refer to Authenticable for more information about writing your own
# method to setup pepper and stretches
# method to setup pepper and stretches.
#
# Examples:
#

View file

@ -3,6 +3,12 @@ require 'digest/sha1'
class AuthenticableTest < ActiveSupport::TestCase
def encrypt_password(user, pepper=nil, stretches=1)
user.class_eval { define_method(:stretches) { stretches } } if stretches
user.password = '123456'
::Digest::SHA1.hexdigest("--#{user.password_salt}--#{pepper}--123456--#{pepper}--")
end
test 'should respond to password and password confirmation' do
user = new_user
assert user.respond_to?(:password)
@ -78,12 +84,6 @@ class AuthenticableTest < ActiveSupport::TestCase
assert_equal encrypt_password(user), user.encrypted_password
end
def encrypt_password(user, pepper=nil, stretches=1)
user.instance_variable_set(:@stretches, stretches) if stretches
user.password = '123456'
::Digest::SHA1.hexdigest("--#{user.password_salt}--#{pepper}--123456--#{pepper}--")
end
test 'should fallback to devise pepper default configuring' do
begin
Devise.pepper = ''