diff options
author | Lauri Ojansivu <x@xet7.org> | 2017-08-09 15:14:11 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2017-08-09 15:14:11 +0300 |
commit | 719c5404f3c1a4116115f27bd5726e9e1620b0d4 (patch) | |
tree | c224561469cba89e9dd02d431f9a8079860e17da /models/users.js | |
parent | 57219df16afbc0c512e15ed9801308591b41d318 (diff) | |
parent | cb4f3ce52ca024d8223b85f47a010ab5383b190a (diff) | |
download | wekan-719c5404f3c1a4116115f27bd5726e9e1620b0d4.tar.gz wekan-719c5404f3c1a4116115f27bd5726e9e1620b0d4.tar.bz2 wekan-719c5404f3c1a4116115f27bd5726e9e1620b0d4.zip |
Merge branch 'nztqa-improve-account' into devel
Change Email address. Thanks to nztqa ! Closes #848
Diffstat (limited to 'models/users.js')
-rw-r--r-- | models/users.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/models/users.js b/models/users.js index 29504aa8..c2238cde 100644 --- a/models/users.js +++ b/models/users.js @@ -334,6 +334,28 @@ Meteor.methods({ check(limit, Number); Meteor.user().setShowCardsCountAt(limit); }, + setEmail(email) { + check(email, String); + const existingUser = Users.findOne({ 'emails.address': email }, { fields: { _id: 1 } }); + if (existingUser) { + throw new Meteor.Error('email-already-taken'); + } else { + Users.update(this.userId, { + $set: { + emails: [{ + address: email, + verified: false, + }], + }, + }); + } + }, + setUsernameAndEmail(username, email) { + check(username, String); + check(email, String); + Meteor.call('setUsername', username); + Meteor.call('setEmail', email); + }, }); if (Meteor.isServer) { |