From dcfcc51f4c705a918e0b8e0545056feee5f01cbf Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 14 Jan 2016 17:28:53 +0000 Subject: [PATCH 1/2] Catch new invalid user name error added in https://github.com/matrix-org/synapse/pull/499 and https://github.com/matrix-org/matrix-doc/pull/263 --- src/Signup.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Signup.js b/src/Signup.js index 42468959fe..2d823b62ae 100644 --- a/src/Signup.js +++ b/src/Signup.js @@ -152,6 +152,8 @@ class Register extends Signup { } else { if (error.errcode === 'M_USER_IN_USE') { throw new Error("Username in use"); + } else if (error.errcode == 'M_INVALID_USER_NAME') { + throw new Error("User names may only contain alphanumeric characters, underscores or dots!"); } else if (error.httpStatus == 401) { throw new Error("Authorisation failed!"); } else if (error.httpStatus >= 400 && error.httpStatus < 500) { From 51ce76aeab75d760c1a26badf901ab818dd741a8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 15 Jan 2016 10:08:16 +0000 Subject: [PATCH 2/2] M_INVALID_USERNAME to be consistent with param name --- src/Signup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Signup.js b/src/Signup.js index 2d823b62ae..fbc2a09634 100644 --- a/src/Signup.js +++ b/src/Signup.js @@ -152,7 +152,7 @@ class Register extends Signup { } else { if (error.errcode === 'M_USER_IN_USE') { throw new Error("Username in use"); - } else if (error.errcode == 'M_INVALID_USER_NAME') { + } else if (error.errcode == 'M_INVALID_USERNAME') { throw new Error("User names may only contain alphanumeric characters, underscores or dots!"); } else if (error.httpStatus == 401) { throw new Error("Authorisation failed!");