Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Commit

Permalink
Move owner identification into SCHNITZELPRESS_OWNER environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
hmans committed Apr 3, 2012
1 parent a23f296 commit 43c9131
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -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:

Expand Down
5 changes: 0 additions & 5 deletions lib/schnitzelpress/actions/auth.rb
Expand Up @@ -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/'
Expand Down
2 changes: 0 additions & 2 deletions lib/schnitzelpress/config.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/schnitzelpress/helpers.rb
Expand Up @@ -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!
Expand Down
1 change: 0 additions & 1 deletion lib/views/admin/config.haml
Expand Up @@ -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."
Expand Down

0 comments on commit 43c9131

Please sign in to comment.