summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/auth-page.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/auth-page.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/auth-page.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/auth-page.js b/packages/meshbay-hub/src/meshbay_hub/static/auth-page.js
index df08bc4..4c00137 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/auth-page.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/auth-page.js
@@ -237,8 +237,11 @@ export function RegisterPage() {
const rk = window.MeshBayKeys.generateRecoveryKey();
// `name` (trimmed), not the raw field: the hub stores the trimmed
// username and every key derivation must fold in the same string.
+ // `captcha.token` rides along — the submit button is already disabled
+ // until it is set when a captcha is configured (see the form below).
await window.MeshBayKeys.registerUser(
- name, email, password, emailRecovery ? rk.mnemonic : null);
+ name, email, password, emailRecovery ? rk.mnemonic : null,
+ captcha.token);
setRecoveryMnemonic(rk.mnemonic);
session.recoveryKey =
await window.MeshBayKeys.deriveRecoveryKey(rk.mnemonic, name);
@@ -257,6 +260,10 @@ export function RegisterPage() {
}
} catch (err) {
setError(err.message);
+ // A reCAPTCHA token is single-use: after a failed attempt (name taken,
+ // e-mail in use…) it is spent, so clear it and make the user solve a
+ // fresh one before the next try. No-op when no captcha is configured.
+ captcha.reset();
} finally {
setLoading(false);
}