Sha256: 6ff4055a26d98ee98f1175f9c29462275d9d7171c85672a7e4efef1d9011110a
Contents?: true
Size: 1 KB
Versions: 5
Compression:
Stored size: 1 KB
Contents
# -*- encoding : utf-8 -*- class FeedbackController < ApplicationController extend Deprecation self.deprecation_horizon = 'Blacklight 5.x' # http://expressica.com/simple_captcha/ # include SimpleCaptcha::ControllerHelpers # show the feedback form def show @errors=[] if request.post? if validate Notifier.feedback(params) redirect_to feedback_complete_path end end end deprecation_deprecate :show protected # validates the incoming params # returns either an empty array or an array with error messages def validate unless params[:name] =~ /\w+/ @errors << I18n.t('blacklight.feedback.valid_name') end unless params[:email] =~ /\w+@\w+\.\w+/ @errors << I18n.t('blacklight.feedback.valid_email') end unless params[:message] =~ /\w+/ @errors << I18n.t('blacklight.feedback.need_message') end #unless simple_captcha_valid? # @errors << 'Captcha did not match' #end @errors.empty? end end
Version data entries
5 entries across 5 versions & 1 rubygems