You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
Use HS proxy API for requestToken on adding email
So we report an error if the email is already taken. Also fix a bug where the spinner wouldn't disappear if adding an email failed (and don't include the raw errcode in the user-facing dialog)
This commit is contained in:
@@ -38,11 +38,13 @@ class AddThreepid {
|
||||
*/
|
||||
addEmailAddress(emailAddress, bind) {
|
||||
this.bind = bind;
|
||||
return MatrixClientPeg.get().requestEmailToken(emailAddress, this.clientSecret, 1).then((res) => {
|
||||
return MatrixClientPeg.get().request3pidAddEmailToken(emailAddress, this.clientSecret, 1).then((res) => {
|
||||
this.sessionId = res.sid;
|
||||
return res;
|
||||
}, function(err) {
|
||||
if (err.httpStatus) {
|
||||
if (err.errcode == 'M_THREEPID_IN_USE') {
|
||||
err.message = "This email address is already in use";
|
||||
} else if (err.httpStatus) {
|
||||
err.message = err.message + ` (Status ${err.httpStatus})`;
|
||||
}
|
||||
throw err;
|
||||
|
||||
Reference in New Issue
Block a user