implement pluggable authentication using classes instead of modules
[coquelicot.git] / lib / coquelicot / auth / simplepass.rb
1 module Coquelicot
2   module Auth
3     class SimplepassAuthenticator < AbstractAuthenticator
4       def authenticate(params)
5         return TRUE if settings.upload_password.nil?
6         upload_password = params['upload_token'].is_a?(Hash) ? params['upload_token']['upload_password'] : params['upload_password']
7         (not upload_password.nil?) && Digest::SHA1.hexdigest(upload_password) == settings.upload_password
8       end
9     end
10   end
11 end