Sha256: f97c3988988b64e220369281135251affa7cd2916e51b0f4f3d4d7178796ddb8
Contents?: true
Size: 1.21 KB
Versions: 43
Compression:
Stored size: 1.21 KB
Contents
class PagesController < ApplicationController before_action :authenticate_user!, only: [ :inside, :contact ] #authorize_resource :class => false 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
43 entries across 43 versions & 1 rubygems