Error on registration if email taken
Use the new register-specific request token endpoint (https://github.com/matrix-org/matrix-js-sdk/pull/147) and catch the error that it gives if the email is already in use. Also add initial values to the registration form so we can reload it after the error without all the values disappearing, and split out the guest username parameter which was previously called defaultUsername.
This commit is contained in:
parent
a2b64798f7
commit
e2c473b366
4 changed files with 29 additions and 20 deletions
|
@ -170,7 +170,7 @@ class EmailIdentityStage extends Stage {
|
|||
encodeURIComponent(this.signupInstance.getServerData().session);
|
||||
|
||||
var self = this;
|
||||
return this.client.requestEmailToken(
|
||||
return this.client.requestRegisterEmailToken(
|
||||
this.signupInstance.email,
|
||||
this.clientSecret,
|
||||
1, // TODO: Multiple send attempts?
|
||||
|
@ -186,8 +186,8 @@ class EmailIdentityStage extends Stage {
|
|||
var e = {
|
||||
isFatal: true
|
||||
};
|
||||
if (error.errcode == 'THREEPID_IN_USE') {
|
||||
e.message = "Email in use";
|
||||
if (error.errcode == 'M_THREEPID_IN_USE') {
|
||||
e.message = "This email address is already registered";
|
||||
} else {
|
||||
e.message = 'Unable to contact the given identity server';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue