Sha256: 516e4ba5776fe6478b8378dee47a24f6d0be9d794581dd76195bbe7dd719f014
Contents?: true
Size: 514 Bytes
Versions: 2
Compression:
Stored size: 514 Bytes
Contents
Warden::Strategies.add(:password) do def subdomain ActionDispatch::Http::URL.extract_subdomains(request.host, 1) end def valid? subdomain.present? && params["user"] end def authenticate! account = Cadenero::V1::Account.find_by_subdomain(subdomain) if account u = account.users.find_by_email(params["user"]["email"]) if u.nil? fail! else u.authenticate(params["user"]["password"]) ? success!(u) : fail! end else fail! end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cadenero-0.0.2.a | config/initializers/warden/strategies/password.rb |
cadenero-0.0.1 | config/initializers/warden/strategies/password.rb |