Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
a342867d
Commit
a342867d
authored
10 years ago
by
Kegan Dougal
Browse files
Options
Downloads
Patches
Plain Diff
Added instructions for setting up captcha in an obviously named file.
parent
b5749c75
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
webclient/CAPTCHA_SETUP
+46
-0
46 additions, 0 deletions
webclient/CAPTCHA_SETUP
webclient/README
+0
-11
0 additions, 11 deletions
webclient/README
webclient/login/register-controller.js
+8
-0
8 additions, 0 deletions
webclient/login/register-controller.js
with
54 additions
and
11 deletions
webclient/CAPTCHA_SETUP
0 → 100644
+
46
−
0
View file @
a342867d
Captcha can be enabled for this web client / home server. This file explains how to do that.
The captcha mechanism used is Google's ReCaptcha. This requires API keys from Google.
Getting keys
------------
Requires a public/private key pair from:
https://developers.google.com/recaptcha/
Setting Private ReCaptcha Key
-----------------------------
The private key is a config option on the home server config. If it is not
visible, you can generate it via --generate-config. Set the following value:
recaptcha_private_key: YOUR_PRIVATE_KEY
In addition, you MUST enable captchas via:
enable_registration_captcha: true
Setting Public ReCaptcha Key
----------------------------
The web client will look for the global variable webClientConfig for config
options. You should put your ReCaptcha public key there like so:
webClientConfig = {
useCaptcha: true,
recaptcha_public_key: "YOUR_PUBLIC_KEY"
}
This should be put in webclient/config.js which is already .gitignored, rather
than in the web client source files. You MUST set useCaptcha to true else a
ReCaptcha widget will not be generated.
Configuring IP used for auth
----------------------------
The ReCaptcha API requires that the IP address of the user who solved the
captcha is sent. If the client is connecting through a proxy or load balancer,
it may be required to use the X-Forwarded-For (XFF) header instead of the origin
IP address. This can be configured as an option on the home server like so:
captcha_ip_origin_is_x_forwarded: true
This diff is collapsed.
Click to expand it.
webclient/README
+
0
−
11
View file @
a342867d
...
...
@@ -11,14 +11,3 @@ Then, open this URL in a WEB browser::
http://127.0.0.1:8000/
ReCaptcha Keys
--------------
The web client will look for the global variable webClientConfig for config options. You should
put your ReCaptcha public key there like so:
webClientConfig = {
recaptcha_public_key: "YOUR_PUBLIC_KEY"
}
This should be put in webclient/config.js which is already .gitignored, rather than in the web
client source files.
This diff is collapsed.
Click to expand it.
webclient/login/register-controller.js
+
8
−
0
View file @
a342867d
...
...
@@ -19,7 +19,11 @@ angular.module('RegisterController', ['matrixService'])
function
(
$scope
,
$rootScope
,
$location
,
matrixService
,
eventStreamService
)
{
'
use strict
'
;
var
config
=
window
.
webClientConfig
;
var
useCaptcha
=
true
;
if
(
config
!==
undefined
)
{
useCaptcha
=
config
.
useCaptcha
;
}
// FIXME: factor out duplication with login-controller.js
...
...
@@ -132,6 +136,10 @@ angular.module('RegisterController', ['matrixService'])
else
if
(
error
.
data
.
errcode
==
"
M_CAPTCHA_INVALID
"
)
{
$scope
.
feedback
=
"
Failed captcha.
"
;
}
else
if
(
error
.
data
.
errcode
==
"
M_CAPTCHA_NEEDED
"
)
{
$scope
.
feedback
=
"
Captcha is required on this home
"
+
"
server.
"
;
}
}
else
if
(
error
.
status
===
0
)
{
$scope
.
feedback
=
"
Unable to talk to the server.
"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment