* Update devise to latest version

* use letter_opener for mails in development
* bring back the flash
* fix redirect loop for logging in
* move all mailer/devise settings to config/config.yml
This commit is contained in:
Henne Vogelsang 2014-03-24 12:45:04 +01:00
parent 7920c3df65
commit 18968a05b1
11 changed files with 53 additions and 16 deletions

View file

@ -1,6 +1,10 @@
defaults: &defaults
# The sender address of emails
devise_mail_sender: no-reply@localhost
# The hostname to be used when building the URL in the emails
url_for_emails: localhost:3000
# A secret key. You can generate one with 'rake secret'
devise_secret_key: 12345
development:
<<: *defaults
@ -10,4 +14,3 @@ test:
production:
<<: *defaults

View file

@ -1,5 +1,14 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
path = Rails.root.join("config", "config.yml")
begin
CONFIG = YAML.load_file(path)[Rails.env]
rescue Exception
puts "Error while parsing config file #{path}"
CONFIG = Hash.new
end
# Initialize the rails application
Osem::Application.initialize!

View file

@ -1,6 +1,9 @@
Osem::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Use letter_opener
config.action_mailer.delivery_method = :letter_opener
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
@ -35,5 +38,5 @@ Osem::Application.configure do
# Expands the lines which load the assets
config.assets.debug = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.default_url_options = { :host => CONFIG['url_for_emails'] }
end

View file

@ -63,4 +63,7 @@ Osem::Application.configure do
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
config.action_mailer.default_url_options = { :host => CONFIG['url_for_emails'] }
end

View file

@ -1,10 +1,12 @@
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# ==> Secret key
config.secret_key = CONFIG['devise_secret_key']
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
config.mailer_sender = "no-reply@conference.opensuse.org"
config.mailer_sender = CONFIG['devise_mail_sender']
# Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer"

View file

@ -1 +0,0 @@
OSEM_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]