Projet

Général

Profil

Paste
Télécharger (2,45 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / honeypot / README.md @ bc175c27

1

    
2
# Honeypot
3

    
4
[![Build Status](https://travis-ci.org/geerlingguy/drupal-honeypot.svg?branch=7.x-1.x)](https://travis-ci.org/geerlingguy/drupal-honeypot)
5

    
6

    
7
## Installation
8

    
9
To install this module, place it in your sites/all/modules folder and enable it
10
on the modules page.
11

    
12

    
13
## Configuration
14

    
15
All settings for this module are on the Honeypot configuration page, under the
16
Configuration section, in the Content authoring settings. You can visit the
17
configuration page directly at admin/config/content/honeypot.
18

    
19
Note that, when testing Honeypot on your website, make sure you're not logged in
20
as an administrative user or user 1; Honeypot allows administrative users to
21
bypass Honeypot protection, so by default, Honeypot will not be added to forms
22
accessed by site administrators.
23

    
24

    
25
## Use in Your Own Forms
26

    
27
If you want to add honeypot to your own forms, or to any form through your own
28
module's hook_form_alter's, you can simply place the following function call
29
inside your form builder function (or inside a hook_form_alter):
30

    
31
    honeypot_add_form_protection(
32
      $form,
33
      $form_state,
34
      array('honeypot', 'time_restriction')
35
    );
36

    
37
Note that you can enable or disable either the honeypot field, or the time
38
restriction on the form by including or not including the option in the array.
39

    
40

    
41
## Testing
42

    
43
Honeypot includes a `docker-compose.yml` file that can be used for testing purposes. To build a Drupal 8 environment for local testing, do the following:
44

    
45
  1. Make sure you have Docker for Mac (or for whatever OS you're using) installed.
46
  2. Add the following entry to your `/etc/hosts` file: `192.168.22.33   local.drupalhoneypot.com`
47
  3. Run `docker-compose up -d` in this directory.
48
  4. Install Drupal: `docker exec honeypot install-drupal 7.x` (optionally provide a version after `install-drupal`).
49
  5. Link the honeypot module directory into the Drupal modules directory: `docker exec honeypot ln -s /opt/honeypot/ /var/www/drupalvm/drupal/web/sites/all/modules/honeypot`
50
  6. Visit `http://local.drupalhoneypot.com/user` and log in using the admin credentials Drush displayed.
51

    
52
> Note: If you're using a Mac, you may also need to perform additional steps to get the hostname working; see [Managing your hosts file](http://docs.drupalvm.com/en/latest/other/docker/#managing-your-hosts-file) in the Drupal VM documentation.
53

    
54

    
55
## Credit
56

    
57
The Honeypot module was originally developed by Jeff Geerling of Midwestern Mac,
58
LLC (midwesternmac.com), and sponsored by Flocknote (flocknote.com).