Permalink
Browse files

better auth

  • Loading branch information...
1 parent a5c03ad commit 731db419641c4350b3134b44f78051a38b74f722 @darkhelmet committed Aug 10, 2010
Showing with 4 additions and 3 deletions.
  1. +1 −2 darkblog.rb
  2. +3 −1 lib/sinatra/authorization.rb
View
3 darkblog.rb
@@ -31,11 +31,10 @@
:index => ENV['BLOG_INDEX'] || 'http://localhost:8080/',
:host => ENV['BLOG_HOST'] || 'blog.darkhax.com',
:email => ENV['BLOG_EMAIL'] || 'darkhelmet@darkhelmetlive.com',
- :username => ENV['BLOG_USERNAME'] || 'darkhelmet',
+ :auth => ENV['BLOG_AUTH'],
:author => ENV['BLOG_AUTHOR'] || 'Daniel Huckstep',
:bio => ENV['BLOG_BIO'] || 'is a software engineer (EIT) in Edmonton, Alberta, Canada',
:feedburner => ENV['BLOG_FEEDBURNER'] || 'VerboseLogging',
- :password => ENV['BLOG_PASSWORD'] || 'password',
:twitter => ENV['BLOG_TWITTER'] || 'darkhelmetlive',
:twitter_password => ENV['BLOG_TWITTER_PASSWORD'] || 'secret',
:disqus => ENV['BLOG_DISQUS'] || 'verboselogging',
View
4 lib/sinatra/authorization.rb
@@ -1,3 +1,5 @@
+require 'digest/sha1'
+
module Sinatra
module Authorization
module Helpers
@@ -19,7 +21,7 @@ def authorized?
end
def authorize(username, password)
- Blog.username == username && Blog.password == password
+ Blog.auth == Digest::SHA1.hexdigest("#{username}:#{password}")
end
def require_administrative_privileges

0 comments on commit 731db41

Please sign in to comment.