class SiteController < ApplicationController #include RecaptchaVerifier def index @pages = PublishedPage.where('type_of != 3').order('priority ASC') @adm = Admin.all end def show pages_get @page = PublishedPage.where('id = ? OR slug = ?',params[:id],params[:id]).first if @page.blank? redirect_to '/404.html' end end def kontakt pages_get end def preview pages_get if params[:id] @page = AllPage.where('id = ? OR slug = ?',params[:id],params[:id]).first end if @page.blank? redirect_to '/404.html' end end def send_email # reCaptcha secret: 6LeaskIUAAAAACcF5jFmO2l7GRzNAKESmzdcxB1k if RecaptchaVerifier.verify(params["g-recaptcha-response"], request.ip) contact = {'name' => params[:name], 'message' => params[:message], 'email' => params[:email]} ContactMailer.contact_email(contact).deliver_now head :ok else return head(:bad_request) end end def pages_get @pages = PublishedPage.where('type_of != 3').order('priority ASC') end end