From 259d9dc3a2cbdf22533c3db2542e8840d51f9e29 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 4 Aug 2015 14:49:01 +0100 Subject: [PATCH] Handle THREEPID_IN_USE error --- src/controllers/templates/Register.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/controllers/templates/Register.js b/src/controllers/templates/Register.js index faff4c66..f76d2edb 100644 --- a/src/controllers/templates/Register.js +++ b/src/controllers/templates/Register.js @@ -242,10 +242,14 @@ module.exports = { }); self.setStep('stage_m.login.email.identity'); }, function(error) { - self.setState({ - busy: false, - errorText: 'Unable to contact the given Home Server' - }); + self.setStep('initial'); + var newState = {busy: false}; + if (error.errcode == 'THREEPID_IN_USE') { + self.onBadFields({email: self.FieldErrors.InUse}); + } else { + newState.errorText = 'Unable to contact the given Home Server'; + } + self.setState(newState); }); break; case 'm.login.recaptcha':