From c63e30a18d0eeb0706673e3139c48cd9a0d1234d Mon Sep 17 00:00:00 2001 From: echarp Date: Fri, 18 Jul 2014 23:31:11 +0200 Subject: [PATCH] =?UTF-8?q?Mod=C3=A9rateur=20et=20admin=20initialis=C3=A9s?= =?UTF-8?q?=20pour=20une=20nouvelle=20base=20de=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.creole | 3 +++ app/models/user.rb | 5 +++++ db/seeds.rb | 2 ++ 3 files changed, 10 insertions(+) diff --git a/README.creole b/README.creole index e3cc45ea..2d107e0d 100644 --- a/README.creole +++ b/README.creole @@ -46,6 +46,9 @@ Puis lancez rails: Vous pouvez finalement accéder à l'agenda dans un navigateur à l'URL suivante: http://localhost:3000 +Votre premier modérateur admin est identifé par "admin@example.com", sont mot +de passe étant "password". + {{{ ° ° ° \ | / \ | / \ | / diff --git a/app/models/user.rb b/app/models/user.rb index 33eda7e7..faea21dc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -17,7 +17,9 @@ class User < ActiveRecord::Base end def self.find_first_by_auth_conditions(warden_conditions) + logger.info 'XXXXXXXXX' conditions = warden_conditions.dup + logger.info conditions if login = conditions.delete(:login) where(conditions).where(["login = :value", { value: login }]).first else @@ -27,6 +29,9 @@ class User < ActiveRecord::Base def valid_password?(password) encrypted_password == password_digest(password) + logger.info 'XXXXXXXXX' + logger.info encrypted_password + logger.info password_digest(password) end def to_s diff --git a/db/seeds.rb b/db/seeds.rb index a9578da4..dd64ae0b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,6 +9,8 @@ # Mayor.create(name: 'Emanuel', city: cities.first) Region.create name: 'Ma première région' +User.create login: 'admin@example.com', email: 'admin@example.com', password: 'password' +AdminUser.create email: 'admin@example.com', password: 'password' I18n::Backend::ActiveRecord::Translation.create([ { locale: 'fr', key: 'layouts.application.subtitle',