You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-12-04 03:22:43 +03:00
ask electron users to do captchas in a web browser.
This will happen anyway when they follow email verification links. make captchas poll for success so if they are completed elsewhere, electron moves on
This commit is contained in:
@@ -52,7 +52,13 @@ DummyStage.TYPE = "m.login.dummy";
|
||||
class RecaptchaStage extends Stage {
|
||||
constructor(matrixClient, signupInstance) {
|
||||
super(RecaptchaStage.TYPE, matrixClient, signupInstance);
|
||||
this.defer = q.defer(); // resolved with the captcha response
|
||||
this.authDict = {
|
||||
auth: {
|
||||
type: 'm.login.recaptcha',
|
||||
// we'll add in the response param if we get one from the local user.
|
||||
},
|
||||
poll_for_success: true,
|
||||
};
|
||||
}
|
||||
|
||||
// called when the recaptcha has been completed.
|
||||
@@ -60,16 +66,15 @@ class RecaptchaStage extends Stage {
|
||||
if (!data || !data.response) {
|
||||
return;
|
||||
}
|
||||
this.defer.resolve({
|
||||
auth: {
|
||||
type: 'm.login.recaptcha',
|
||||
response: data.response,
|
||||
}
|
||||
});
|
||||
this.authDict.response = data.response;
|
||||
}
|
||||
|
||||
complete() {
|
||||
return this.defer.promise;
|
||||
// we return the authDict with no response, telling Signup to keep polling
|
||||
// the server in case the captcha is filled in on another window (e.g. by
|
||||
// following a nextlink from an email signup). If the user completes the
|
||||
// captcha locally, then we return at the next poll.
|
||||
return q(this.authDict);
|
||||
}
|
||||
}
|
||||
RecaptchaStage.TYPE = "m.login.recaptcha";
|
||||
|
||||
Reference in New Issue
Block a user