summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2016-11-20 23:01:57 +0200
committerGitHub <noreply@github.com>2016-11-20 23:01:57 +0200
commit532a3bbb49e0257aa3cea1183687452b4dc28f14 (patch)
treeeb159f8ec1c50d6c3266671f7af4381902289fcc
parent94cdcff79f79079263056905f6a3f1128088e0a8 (diff)
parent828d34b70eeb4a86d9a18564e703a28001b4601e (diff)
downloadwekan-532a3bbb49e0257aa3cea1183687452b4dc28f14.tar.gz
wekan-532a3bbb49e0257aa3cea1183687452b4dc28f14.tar.bz2
wekan-532a3bbb49e0257aa3cea1183687452b4dc28f14.zip
Merge pull request #17 from mario-orlicky/show-error-username-taken
Display message when user wants to choose existing username (Fixes: #16)
-rw-r--r--client/components/users/userHeader.jade2
-rw-r--r--client/components/users/userHeader.js15
-rwxr-xr-xi18n/en.i18n.json1
3 files changed, 14 insertions, 4 deletions
diff --git a/client/components/users/userHeader.jade b/client/components/users/userHeader.jade
index a71e7fc7..ce8cf1af 100644
--- a/client/components/users/userHeader.jade
+++ b/client/components/users/userHeader.jade
@@ -27,6 +27,8 @@ template(name="editProfilePopup")
input.js-profile-fullname(type="text" value=profile.fullname autofocus)
label
| {{_ 'username'}}
+ span.error.hide.username-taken
+ | {{_ 'error-username-taken'}}
input.js-profile-username(type="text" value=username)
label
| {{_ 'initials'}}
diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js
index 10fdf699..17d9eb5f 100644
--- a/client/components/users/userHeader.js
+++ b/client/components/users/userHeader.js
@@ -26,11 +26,18 @@ Template.editProfilePopup.events({
'profile.fullname': fullname,
'profile.initials': initials,
}});
- // XXX We should report the error to the user.
+
if (username !== Meteor.user().username) {
- Meteor.call('setUsername', username);
- }
- Popup.back();
+ Meteor.call('setUsername', username, function(error) {
+ const messageElement = tpl.$('.username-taken');
+ if (error) {
+ messageElement.show();
+ } else {
+ messageElement.hide();
+ Popup.back();
+ }
+ });
+ } else Popup.back();
},
});
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index c92d6a71..54e6b394 100755
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -169,6 +169,7 @@
"error-user-doesNotExist": "This user does not exist",
"error-user-notAllowSelf": "This action on self is not allowed",
"error-user-notCreated": "This user is not created",
+ "error-username-taken": "This username is already taken",
"export-board": "Export board",
"filter": "Filter",
"filter-cards": "Filter Cards",