first commit
This commit is contained in:
commit
82f8b28353
28 files changed
+1210
No files matched your search
@@ -0,0 +1,37 @@
|
||||
class Netig
|
||||
hash_branch "contact" do |r|
|
||||
r.is do
|
||||
r.get do
|
||||
@page_title = "Contact — NETig"
|
||||
@page_description = "Contacter NETig pour toute question concernant ses services."
|
||||
@canonical_url = "https://netig.net/contact"
|
||||
|
||||
view "contact"
|
||||
end
|
||||
end
|
||||
|
||||
r.post "send" do
|
||||
check_csrf!
|
||||
|
||||
form = ContactForm.new(r.params)
|
||||
|
||||
if form.spam?
|
||||
flash["notice"] = "Votre message a été reçu."
|
||||
r.redirect "/contact"
|
||||
elsif form.valid?
|
||||
begin
|
||||
ContactMailer.new(r.params).deliver
|
||||
flash["notice"] = "Votre message a été envoyé."
|
||||
rescue Net::SMTPError, SocketError, SystemCallError, IOError, Timeout::Error, OpenSSL::SSL::SSLError => error
|
||||
warn "Échec SMTP : #{error.class}"
|
||||
flash["error"] = "L'envoi a échoué. Veuillez réessayer plus tard."
|
||||
end
|
||||
r.redirect "/contact"
|
||||
else
|
||||
response.status = 422
|
||||
flash.now["error"] = "Veuillez vérifier les champs du formulaire."
|
||||
view "contact"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user