Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# encoding: UTF-8
class RegistrationsController < Devise::RegistrationsController

def create
honeypot = params[:account].delete(:pot_de_miel)
if honeypot.present?
head :no_content
else
super
end
end

def edit
self.resource.totoz_style = cookies.permanent["totoz-type"]
self.resource.totoz_source = cookies.permanent["totoz-url"]
Expand Down
2 changes: 2 additions & 0 deletions app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class Account < ActiveRecord::Base

mount_uploader :uploaded_stylesheet, StylesheetUploader

attr_accessor :pot_de_miel

attr_accessor :amr_id
delegate :name, to: :user

Expand Down
3 changes: 3 additions & 0 deletions app/views/devise/registrations/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
%p
= f.label :email, "Adresse de courriel"
= f.email_field :email, required: "required"
%p.pot_de_miel
= f.label :pot_de_miel, "Ne pas remplir ce champ"
= f.text_field :pot_de_miel
%p
= f.submit "S’inscrire"

Expand Down
8 changes: 6 additions & 2 deletions db/pages/a-propos.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ <h3>N’attendez plus et rejoignez la communauté</h3>
<form class="new_account" id="new_account" action="/compte" accept-charset="UTF-8" method="post">
<p>
<label for="account_login">Identifiant</label>
<input required="required" maxlength="40" size="40" type="text" name="account[login]" id="account_login" />
<input required maxlength="40" size="40" type="text" name="account[login]" id="account_login" />
</p>
<p>
<label for="account_email">Adresse de courriel</label>
<input required="required" type="email" name="account[email]" id="account_email" />
<input required type="email" name="account[email]" id="account_email" />
</p>
<p class="pot_de_miel">
<label for="pot_de_miel">Ne pas remplir ce champ</label>
<input type="text" name="account[pot_de_miel]" id="pot_de_miel" />
</p>
<p>
<input type="submit" name="commit" value="Créer mon compte" data-disable-with="Créer mon compte" />
Expand Down