introduce authentication mechanism framework
[coquelicot.git] / lib / coquelicot / auth / simplepass.rb
1 module Coquelicot
2   module Auth
3     module Simplepass
4
5       def authenticate(params)
6         return TRUE if settings.upload_password.nil?
7         upload_password = params['upload_token'].is_a?(Hash) ? params['upload_token']['upload_password'] : params['upload_password']
8         (not upload_password.nil?) && Digest::SHA1.hexdigest(upload_password) == settings.upload_password
9       end
10     end
11   end
12 end