Permalink
Browse files

Add OmniAuth "developer" provider in development mode.

  • Loading branch information...
1 parent 733987b commit d7de612a2ba9b8cfc0e3e4cc6bfa510f2ad86f55 @hmans committed Mar 8, 2012
Showing with 9 additions and 4 deletions.
  1. +1 −0 CHANGES.md
  2. +1 −0 lib/schnitzelpress/actions/auth.rb
  3. +1 −4 lib/schnitzelpress/helpers.rb
  4. +6 −0 lib/views/login.haml
View
@@ -12,6 +12,7 @@ Changes:
* Most of your blog's configuration is now stored in MongoDB and can be modified from the new "Configuration" page in your the admin panel.
* When logged in as an admin, you will be shown a small admin actions panel in the upper right corner of your browser, allowing you to quickly edit posts, jump to the admin section, or log out.
* Schnitzelpress now has a light-weight, custom-built asset pipeline that serves all Javascripts and Stylesheets as one single file each, compressed and ready for hardcore caching.
+* When running Schnitzelpress locally (aka: development mode), you can use a simple developer-only login provider to log into your blog for testing purposes.
* Post with dates now use double-digit days and months in their canonical URLs. (Your existing posts will forward to the new canonical URLs automatically.)
* Various performance improvements.
@@ -8,6 +8,7 @@ module Auth
included do
use OmniAuth::Strategies::BrowserID
+ use OmniAuth::Strategies::Developer if Schnitzelpress.env.development?
post '/auth/:provider/callback' do
auth = request.env['omniauth.auth']
@@ -48,10 +48,7 @@ def user_logged_in?
end
def admin_logged_in?
- user_logged_in? && session[:auth] == {
- :provider => "browser_id",
- :uid => config.author_email
- }
+ user_logged_in? && (session[:auth][:uid] == config.author_email)
end
def admin_only!
View
@@ -9,3 +9,9 @@
%form{:method => 'post', :action => '/auth/browser_id/callback', :noValidate => 'noValidate'}
%input{:type => 'hidden', :name => 'assertion'}
+
+ - if Schnitzelpress.env.development?
+ %hr
+ %p
+ Since you're running Schnitzelpress in development mode, you can also use
+ the <a href="/auth/developer">development login provider</a>.

0 comments on commit d7de612

Please sign in to comment.