Skip to content
Snippets Groups Projects
Commit c80f7394 authored by Kegan Dougal's avatar Kegan Dougal
Browse files

Added webclient config.js for storing recaptcha public key.

parent 13045838
No related branches found
No related tags found
No related merge requests found
...@@ -24,4 +24,6 @@ graph/*.svg ...@@ -24,4 +24,6 @@ graph/*.svg
graph/*.png graph/*.png
graph/*.dot graph/*.dot
webclient/config.js
uploads uploads
Basic Usage Basic Usage
----------- -----------
The Synapse web client needs to be hosted by a basic HTTP server. The web client should automatically run when running the home server. Alternatively, you can run
it stand-alone:
You can use the Python simple HTTP server::
$ python -m SimpleHTTPServer $ python -m SimpleHTTPServer
Then, open this URL in a WEB browser:: Then, open this URL in a WEB browser::
http://127.0.0.1:8000/ 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.
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<script src="js/angular-sanitize.min.js"></script> <script src="js/angular-sanitize.min.js"></script>
<script type='text/javascript' src='js/ng-infinite-scroll-matrix.js'></script> <script type='text/javascript' src='js/ng-infinite-scroll-matrix.js'></script>
<script src="app.js"></script> <script src="app.js"></script>
<script src="config.js"></script>
<script src="app-controller.js"></script> <script src="app-controller.js"></script>
<script src="app-directive.js"></script> <script src="app-directive.js"></script>
<script src="app-filter.js"></script> <script src="app-filter.js"></script>
......
...@@ -19,7 +19,7 @@ angular.module('RegisterController', ['matrixService']) ...@@ -19,7 +19,7 @@ angular.module('RegisterController', ['matrixService'])
function($scope, $rootScope, $location, matrixService, eventStreamService) { function($scope, $rootScope, $location, matrixService, eventStreamService) {
'use strict'; 'use strict';
var useCaptcha = false; var useCaptcha = true;
// FIXME: factor out duplication with login-controller.js // FIXME: factor out duplication with login-controller.js
...@@ -147,7 +147,18 @@ angular.module('RegisterController', ['matrixService']) ...@@ -147,7 +147,18 @@ angular.module('RegisterController', ['matrixService'])
var setupCaptcha = function() { var setupCaptcha = function() {
console.log("Setting up ReCaptcha") console.log("Setting up ReCaptcha")
Recaptcha.create("6Le31_kSAAAAAK-54VKccKamtr-MFA_3WS1d_fGV", var config = window.webClientConfig;
var public_key = undefined;
if (config === undefined) {
console.error("Couldn't find webClientConfig. Cannot get public key for captcha.");
}
else {
public_key = webClientConfig.recaptcha_public_key;
if (public_key === undefined) {
console.error("No public key defined for captcha!")
}
}
Recaptcha.create(public_key,
"regcaptcha", "regcaptcha",
{ {
theme: "red", theme: "red",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment