Sha256: 6c2be8ca7e851c0917058b4c93fb7f1ed2722bdf8641c344ccde7a713d50f80f
Contents?: true
Size: 1.45 KB
Versions: 83
Compression:
Stored size: 1.45 KB
Contents
class PagesController < ApplicationController before_action :authenticate_user!, only: [ :inside, :contact ] # So the static link navigation can be set runtime (yes it's an hack # since I have to set this dynamically at runtime, using a class # continously re-evaluated) RailsAdmin.config do |config| config.navigation_static_label = I18n.t('admin.links.label') end def home end def inside end def email @name = params[:name] @email = params[:email] @message = params[:message] if @name.blank? flash[:alert] = "Please enter your name before sending your message. Thank you." render :contact elsif @email.blank? || @email.scan(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i).size < 1 flash[:alert] = "You must provide a valid email address before sending your message. Thank you." render :contact elsif @message.blank? || @message.length < 10 flash[:alert] = "Your message is empty. Requires at least 10 characters. Nothing to send." render :contact elsif @message.scan(/<a href=/).size > 0 || @message.scan(/\[url=/).size > 0 || @message.scan(/\[link=/).size > 0 || @message.scan(/http:\/\//).size > 0 flash[:alert] = "You can't send links. Thank you for your understanding." render :contact else ContactMailer.contact_message(@name,@email,@message).deliver_now redirect_to root_path, notice: "Your message was sent. Thank you." end end end
Version data entries
83 entries across 83 versions & 3 rubygems
Version | Path |
---|---|
thecore-1.7.7 | app/controllers/pages_controller.rb |
thecore-1.7.5 | app/controllers/pages_controller.rb |
thecore-1.7.3 | app/controllers/pages_controller.rb |