Sha256: 876604ba5a03fbcba71f5cd139942d18a51290922d9047e1f9bd3bce85c97bfb
Contents?: true
Size: 681 Bytes
Versions: 5
Compression:
Stored size: 681 Bytes
Contents
Warden::Strategies.add(:password) do def subdomain ActionDispatch::Http::URL.extract_subdomains(request.host, 1) end def json_params unless params.empty? params else @json ||= env['rack.input'].gets JSON.parse(@json) end end def valid? subdomain.present? && json_params["user"] end def authenticate! account = Cadenero::V1::Account.get_by_subdomain(subdomain) if account u = account.users.find_by_email(json_params["user"]["email"]) if u.nil? || u.blank? fail! else u.authenticate(json_params["user"]["password"]) ? success!(u) : fail! end else fail! end end end
Version data entries
5 entries across 5 versions & 1 rubygems