Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rdegan/spree_migrate_to_devise
base: master
...
head fork: rdegan/spree_migrate_to_devise
compare: authlogic_sha512
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
1  import_old_user.sql
@@ -0,0 +1 @@
+INSERT spree_users (email,password_salt,login,crypted_password) select email,password_salt,email,crypted_password FROM old_users
View
18 lib/devise/password_encryption_migration.rb
@@ -3,29 +3,37 @@ module Devise
module PasswordEncryptionMigration
def valid_password?(incoming_password)
- if using_authlogic_validation?
+ if using_authlogic_validation?(incoming_password)
+
Devise.secure_compare(authlogic_password_digest(incoming_password), self.crypted_password).tap do |validated|
if validated
self.password = incoming_password
self.crypted_password = nil
self.save(:validate => false)
end
+ validated
end
else
- Devise.secure_compare(password_digest(incoming_password), self.encrypted_password)
+ true
end
end
- def using_authlogic_validation?
- self.encrypted_password.blank?
+ def using_authlogic_validation?(incoming_password)
+ !Devise.secure_compare(password_digest(incoming_password), self.encrypted_password)
end
def authlogic_password_digest(password)
if self.password_salt.present?
- Digest::SHA1.hexdigest("--#{password_salt}--#{password}--")
+ encrypt(password,password_salt)
end
end
+ def encrypt(password,password_salt)
+ digest = "#{password}#{password_salt}"
+ 20.times { digest = Digest::SHA512.hexdigest(digest) }
+ digest
+ end
+
end
end
View
11 lib/generators/spree_migrate_to_devise/install/install_generator.rb
@@ -2,16 +2,7 @@ module SpreeMigrateToDevise
module Generators
class InstallGenerator < Rails::Generators::Base
- def add_javascripts
- append_file "app/assets/javascripts/store/all.js", "//= require store/spree_migrate_to_devise\n"
- append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_migrate_to_devise\n"
- end
-
- def add_stylesheets
- inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_migrate_to_devise\n", :before => /\*\//, :verbose => true
- inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_migrate_to_devise\n", :before => /\*\//, :verbose => true
- end
-
+
def add_migrations
run 'bundle exec rake railties:install:migrations FROM=spree_migrate_to_devise'
end

No commit comments for this range

Something went wrong with that request. Please try again.