When i add default users in my rails app via rake task all goes fine, but when i try to login i can't access. Instead, if i sign up via the form, then I can access to the backend of my rails app.
I need to add Users via rake command but I don't understand why I can't login after the users are added to the db.
rails v 3.2.8 devise v 3.2.0
desc "Create a default admin user"
task :default_user => :environment do
User.create(name: "myname", email: "my@email.com", login: "mylogin", password: "mypassword", password_confirmation: "mypassword")
end
I use the following modules:
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :encryptable, :encryptor => :restful_authentication_sha1
Since I switched from restful_authentication to devise, I've included
:encryptable, :encryptor => :restful_authentication_sha1
If they are omitted, I suppose that the old users, already present in my users table, can't login, but if a new user is created via rake task, then I can login with it.