diff --git a/CHANGES.md b/CHANGES.md index 1629f55..a410e22 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ Upgrade Notes: * SchnitzelPress has been rebranded to Schnitzelpress (lower-case p). You'll probably need to adjust your blog app's code for this. (Better now than later, I guess!) * Schnitzelpress now adds Rack::Cache in production by itself; you no longer need to do it in your blog app's config.ru file. It is recommended that you remove the Rack::Cache invocation from your app. * Configuration is now stored in the database and can be edited from the new "Configuration" page in your Admin Panel; this obviously means that some of the stuff happening within your blog application can (and, in some cases, should) be removed. Please consult the Schnitzelpress 0.2.0 Upgrade Guide for details. +* Schnitzelpress now expects an environment variable to be present named SCHNITZELPRESS_OWNER, containing the email address of the admin user. Changes: diff --git a/lib/schnitzelpress/actions/auth.rb b/lib/schnitzelpress/actions/auth.rb index a982858..1f53ba0 100644 --- a/lib/schnitzelpress/actions/auth.rb +++ b/lib/schnitzelpress/actions/auth.rb @@ -18,11 +18,6 @@ module Auth auth = request.env['omniauth.auth'] session[:auth] = {:provider => auth['provider'], :uid => auth['uid']} - # if no configuration is present yet, make this user the blog's admin - if config.author_email.blank? - config.update_attributes!(:author_email => auth['uid']) - end - if admin_logged_in? response.set_cookie('show_admin', :value => true, :path => '/') redirect '/admin/' diff --git a/lib/schnitzelpress/config.rb b/lib/schnitzelpress/config.rb index 093872c..c5d98fb 100644 --- a/lib/schnitzelpress/config.rb +++ b/lib/schnitzelpress/config.rb @@ -11,7 +11,6 @@ class Config field :blog_feed_url, :type => String, :default => "/blog.atom" field :author_name, :type => String, :default => "Joe Schnitzel" - field :author_email, :type => String, :default => "" field :disqus_id, :type => String field :google_analytics_id, :type => String @@ -21,7 +20,6 @@ class Config field :cache_timestamp, :type => DateTime validates :blog_title, :author_name, :presence => true - validates :author_email, :presence => true, :on => :update class << self def instance diff --git a/lib/schnitzelpress/helpers.rb b/lib/schnitzelpress/helpers.rb index 634ded2..684d67a 100644 --- a/lib/schnitzelpress/helpers.rb +++ b/lib/schnitzelpress/helpers.rb @@ -48,7 +48,7 @@ def user_logged_in? end def admin_logged_in? - user_logged_in? && (session[:auth][:uid] == config.author_email) + user_logged_in? && (session[:auth][:uid] == ENV['SCHNITZELPRESS_OWNER']) end def admin_only! diff --git a/lib/views/admin/config.haml b/lib/views/admin/config.haml index 352b482..da26169 100644 --- a/lib/views/admin/config.haml +++ b/lib/views/admin/config.haml @@ -9,7 +9,6 @@ %h2 Author = form_field config, :author_name - = form_field config, :author_email, :hint => "This is used for authentication - make sure you don't lock yourself out!" %h2 External Services = form_field config, :blog_feed_url, :label => "ATOM Feed URL", :hint => "This is what the /feed URL will redirect to. You can change this to eg. your FeedBurner URL."