mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
* 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:
parent
7920c3df65
commit
18968a05b1
11 changed files with 53 additions and 16 deletions
5
Gemfile
5
Gemfile
|
|
@ -20,11 +20,12 @@ group :development, :test do
|
|||
gem 'pry'
|
||||
gem 'sqlite3'
|
||||
gem 'thin'
|
||||
gem 'rspec-rails', '2.11.0'
|
||||
gem 'letter_opener'
|
||||
end
|
||||
|
||||
group :production do
|
||||
gem 'mysql2'
|
||||
gem 'rspec-rails', '2.11.0'
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
|
@ -36,7 +37,7 @@ gem 'paperclip', '~> 3.0'
|
|||
gem 'jquery-rails'
|
||||
gem 'jquery-ui-rails'
|
||||
gem 'jquery-fileupload-rails'
|
||||
gem 'devise', '~> 2.2'
|
||||
gem 'devise'
|
||||
gem 'cancan'
|
||||
gem "haml"
|
||||
gem 'bcrypt-ruby', '~> 3.0.0'
|
||||
|
|
|
|||
23
Gemfile.lock
23
Gemfile.lock
|
|
@ -34,7 +34,9 @@ GEM
|
|||
activerecord (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
awesome_nested_set (>= 2.0)
|
||||
addressable (2.3.5)
|
||||
arel (3.0.3)
|
||||
atomic (1.1.16)
|
||||
awesome_nested_set (2.1.6)
|
||||
activerecord (>= 3.0.0)
|
||||
axlsx (2.0.1)
|
||||
|
|
@ -44,6 +46,7 @@ GEM
|
|||
axlsx_rails (0.1.5)
|
||||
axlsx
|
||||
rails (>= 3.1)
|
||||
bcrypt (3.1.7)
|
||||
bcrypt-ruby (3.0.1)
|
||||
bootstrap-sass (3.1.1.0)
|
||||
sass (~> 3.2)
|
||||
|
|
@ -67,11 +70,12 @@ GEM
|
|||
d3_rails (3.4.3)
|
||||
railties (>= 3.1.0)
|
||||
daemons (1.1.9)
|
||||
devise (2.2.8)
|
||||
bcrypt-ruby (~> 3.0)
|
||||
devise (3.2.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (~> 3.1)
|
||||
warden (~> 1.2.1)
|
||||
railties (>= 3.2.6, < 5)
|
||||
thread_safe (~> 0.1)
|
||||
warden (~> 1.2.3)
|
||||
diff-lcs (1.1.3)
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.0.3)
|
||||
|
|
@ -97,6 +101,10 @@ GEM
|
|||
jquery-ui-rails (4.1.2)
|
||||
railties (>= 3.1.0)
|
||||
json (1.8.1)
|
||||
launchy (2.4.2)
|
||||
addressable (~> 2.3)
|
||||
letter_opener (1.2.0)
|
||||
launchy (~> 2.2)
|
||||
libv8 (3.16.14.3)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
|
|
@ -104,7 +112,7 @@ GEM
|
|||
method_source (0.8.2)
|
||||
mime-types (1.25.1)
|
||||
mini_portile (0.5.2)
|
||||
multi_json (1.9.0)
|
||||
multi_json (1.9.2)
|
||||
mysql2 (0.3.15)
|
||||
nokogiri (1.6.1)
|
||||
mini_portile (~> 0.5.0)
|
||||
|
|
@ -194,6 +202,8 @@ GEM
|
|||
eventmachine (>= 1.0.0)
|
||||
rack (>= 1.0.0)
|
||||
thor (0.18.1)
|
||||
thread_safe (0.3.1)
|
||||
atomic (>= 1.1.7, < 2)
|
||||
tilt (1.4.1)
|
||||
transitions (0.1.12)
|
||||
treetop (1.4.15)
|
||||
|
|
@ -224,13 +234,14 @@ DEPENDENCIES
|
|||
capybara (= 1.1.2)
|
||||
cocoon
|
||||
d3_rails
|
||||
devise (~> 2.2)
|
||||
devise
|
||||
formtastic-bootstrap
|
||||
gravtastic
|
||||
haml
|
||||
jquery-fileupload-rails
|
||||
jquery-rails
|
||||
jquery-ui-rails
|
||||
letter_opener
|
||||
mysql2
|
||||
paper_trail
|
||||
paperclip (~> 3.0)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ body {
|
|||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
body > #content {
|
||||
body > #messages {
|
||||
padding: 60px 15px 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,13 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
session[:return_to]
|
||||
if not session[:return_to].start_with?('/accounts')
|
||||
logger.debug "Returning to #{session[:return_to]}"
|
||||
session[:return_to]
|
||||
else
|
||||
logger.debug "Not returning to #{session[:return_to]} because it would loop"
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def get_conferences
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ class EmailSettings < ActiveRecord::Base
|
|||
"email" => person.email,
|
||||
"name" => person.public_name,
|
||||
"conference" => conference.title,
|
||||
"registrationlink" => Rails.application.routes.url_helpers.register_conference_url(conference.short_title, :host => OSEM_CONFIG["url_for_emails"])
|
||||
"registrationlink" => Rails.application.routes.url_helpers.register_conference_url(conference.short_title, :host => CONFIG["url_for_emails"])
|
||||
}
|
||||
|
||||
if !event.nil?
|
||||
h["eventtitle"] = event.title
|
||||
h["proposalslink"] = Rails.application.routes.url_helpers.conference_proposal_url(conference.short_title, event, :host => OSEM_CONFIG["url_for_emails"])
|
||||
h["proposalslink"] = Rails.application.routes.url_helpers.conference_proposal_url(conference.short_title, event, :host => CONFIG["url_for_emails"])
|
||||
end
|
||||
h
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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!
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
OSEM_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]
|
||||
Loading…
Add table
Add a link
Reference in a new issue