summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorsoohwa <none@none.none>2017-09-25 21:03:18 +0900
committersoohwa <none@none.none>2017-09-25 21:03:18 +0900
commitdeef0855d5420c7fa30c138d68cdae8b8f5c690d (patch)
tree9f9cb4820751c38db220f0f73d452ff78d9c19c9 /models
parentfb79c8786ae32d6d2d46738815ed2b5f43a3f870 (diff)
downloadwekan-deef0855d5420c7fa30c138d68cdae8b8f5c690d.tar.gz
wekan-deef0855d5420c7fa30c138d68cdae8b8f5c690d.tar.bz2
wekan-deef0855d5420c7fa30c138d68cdae8b8f5c690d.zip
Fix https://github.com/wekan/wekan/issues/1249
Diffstat (limited to 'models')
-rw-r--r--models/users.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/models/users.js b/models/users.js
index c2238cde..43faf4d4 100644
--- a/models/users.js
+++ b/models/users.js
@@ -108,6 +108,10 @@ Users.attachSchema(new SimpleSchema({
type: Boolean,
optional: true,
},
+ fromAdmin: {
+ type: Boolean,
+ optional: true,
+ },
}));
// Search a user in the complete server database by its name or username. This
@@ -435,6 +439,12 @@ if (Meteor.isServer) {
user.isAdmin = true;
return user;
}
+
+ if (options.from == 'admin') {
+ user.fromAdmin = true;
+ return user;
+ }
+
const disableRegistration = Settings.findOne().disableRegistration;
if (!disableRegistration) {
return user;
@@ -524,6 +534,9 @@ if (Meteor.isServer) {
Users.after.insert((userId, doc) => {
+ if (doc.fromAdmin)
+ return;
+
//invite user to corresponding boards
const disableRegistration = Settings.findOne().disableRegistration;
if (disableRegistration) {
@@ -582,6 +595,7 @@ if (Meteor.isServer) {
username: req.body.username,
email: req.body.email,
password: 'default',
+ from: 'admin'
});
JsonRoutes.sendResult(res, {