Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move owner identification into SCHNITZELPRESS_OWNER environment variable

  • Loading branch information...
commit 43c913102d850f95ffe7b0d998a4ecd63a590591 1 parent a23f296
@hmans authored
View
1  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:
View
5 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/'
View
2  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
View
2  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!
View
1  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."
Please sign in to comment.
Something went wrong with that request. Please try again.