-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add-recaptcha-support' into 'master'
Add support for Google reCAPTCHA in user registration to prevent spammers See merge request !2216
- Loading branch information
1 parent
795a29a
commit 2ef0fec
Showing
10 changed files
with
120 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
if Gitlab.config.recaptcha.enabled | ||
Recaptcha.configure do |config| | ||
config.public_key = Gitlab.config.recaptcha['public_key'] | ||
config.private_key = Gitlab.config.recaptcha['private_key'] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# reCAPTCHA | ||
|
||
GitLab leverages [Google's reCAPTCHA](https://www.google.com/recaptcha/intro/index.html) | ||
to protect against spam and abuse. GitLab displays the CAPTCHA form on the sign-up page | ||
to confirm that a real user, not a bot, is attempting to create an account. | ||
|
||
## Configuration | ||
|
||
To use reCAPTCHA, first you must create a public and private key. | ||
|
||
1. Go to the URL: https://www.google.com/recaptcha/admin | ||
|
||
1. Fill out the form necessary to obtain reCAPTCHA keys. | ||
|
||
1. On your GitLab server, open the configuration file. | ||
|
||
For omnibus package: | ||
|
||
```sh | ||
sudo editor /etc/gitlab/gitlab.rb | ||
``` | ||
|
||
For installations from source: | ||
|
||
```sh | ||
cd /home/git/gitlab | ||
sudo -u git -H editor config/gitlab.yml | ||
``` | ||
|
||
1. Enable reCAPTCHA and add the settings: | ||
|
||
For omnibus package: | ||
|
||
```ruby | ||
gitlab_rails['recaptcha_enabled'] = true | ||
gitlab_rails['recaptcha_public_key'] = 'YOUR_PUBLIC_KEY' | ||
gitlab_rails['recaptcha_private_key'] = 'YOUR_PUBLIC_KEY' | ||
``` | ||
|
||
For installation from source: | ||
|
||
``` | ||
recaptcha: | ||
enabled: true | ||
public_key: 'YOUR_PUBLIC_KEY' | ||
private_key: 'YOUR_PRIVATE_KEY' | ||
``` | ||
|
||
1. Change 'YOUR_PUBLIC_KEY' to the public key from step 2. | ||
|
||
1. Change 'YOUR_PRIVATE_KEY' to the private key from step 2. | ||
|
||
1. Save the configuration file. | ||
|
||
1. Restart GitLab. |