anti spam prescription
This commit is contained in:
parent
1f9a37ad60
commit
71b38f23b2
@ -11,6 +11,11 @@ class Public::PrescriptionsController < ApplicationController
|
||||
@prescription = Prescription.new(params[:prescription])
|
||||
@menu_item = MenuItem.find_by_permalink('ordonnances')
|
||||
@title = @menu_item.name
|
||||
|
||||
if @prescription.email and @prescription.email != ""
|
||||
redirect_to "/pages/ordonnances.html"
|
||||
else
|
||||
|
||||
if @prescription.save
|
||||
|
||||
Notification.prescription_received.deliver
|
||||
@ -20,5 +25,6 @@ class Public::PrescriptionsController < ApplicationController
|
||||
render :template => "public/menu_items/show"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -3,6 +3,9 @@ class Prescription < ActiveRecord::Base
|
||||
|
||||
mount_uploader :file, PrescriptionUploader
|
||||
|
||||
attr_accessor :email
|
||||
attr_accessible :email, :tel, :name, :note
|
||||
|
||||
validates :name, :presence => true
|
||||
validates :tel, :presence => true
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
-@prescription = @prescription || Prescription.new
|
||||
|
||||
=form_for @prescription, :url => create_prescription_path(), :html => {:multipart => true} do |form|
|
||||
|
||||
=form.text_field :email, :placeholder => "ne doit pas être remplis.", :style => "display:none;"
|
||||
%h2 Etape 1 : Vos coordonnées
|
||||
%table
|
||||
%tr
|
||||
|
Loading…
x
Reference in New Issue
Block a user