mirror of
https://github.com/wekan/wekan.git
synced 2026-01-05 17:18:49 +01:00
Create New User in Admin Panel. Works, but does not save fullname yet,
so currently it's needed to edit add fullname later. Thanks to xet7 ! Related #802
This commit is contained in:
parent
0e755e021b
commit
e0ca960a35
4 changed files with 179 additions and 1 deletions
|
|
@ -620,6 +620,34 @@ Users.mutations({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
setCreateUser(fullname, username, password, isAdmin, isActive, email) {
|
||||
if (Meteor.user().isAdmin) {
|
||||
check(fullname, String);
|
||||
check(username, String);
|
||||
check(password, String);
|
||||
check(isAdmin, String);
|
||||
check(isActive, String);
|
||||
check(email, String);
|
||||
|
||||
const nUsersWithUsername = Users.find({ username }).count();
|
||||
const nUsersWithEmail = Users.find({ email }).count();
|
||||
if (nUsersWithUsername > 0) {
|
||||
throw new Meteor.Error('username-already-taken');
|
||||
} else if (nUsersWithEmail > 0) {
|
||||
throw new Meteor.Error('email-already-taken');
|
||||
} else {
|
||||
Accounts.createUser({
|
||||
fullname,
|
||||
username,
|
||||
password,
|
||||
isAdmin,
|
||||
isActive,
|
||||
email: email.toLowerCase(),
|
||||
from: 'admin',
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
setUsername(username, userId) {
|
||||
check(username, String);
|
||||
check(userId, String);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue