summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2018-10-10 00:14:51 +0300
committerLauri Ojansivu <x@xet7.org>2018-10-10 00:14:51 +0300
commitbf42372eefb8f5e946ed294edc554804987aa204 (patch)
tree6890aa455bf159b8bd6b7b45b217ea8b76a31b76 /models
parent58855ada97677d25475ba4721834c0f576ed3b47 (diff)
parent5e9bf61d3f97befaa240be015755af96034f1859 (diff)
downloadwekan-bf42372eefb8f5e946ed294edc554804987aa204.tar.gz
wekan-bf42372eefb8f5e946ed294edc554804987aa204.tar.bz2
wekan-bf42372eefb8f5e946ed294edc554804987aa204.zip
Merge branch 'Akuket-edge' into edge
Diffstat (limited to 'models')
-rw-r--r--models/settings.js2
-rw-r--r--models/users.js14
2 files changed, 9 insertions, 7 deletions
diff --git a/models/settings.js b/models/settings.js
index f7c4c85d..bb555cf9 100644
--- a/models/settings.js
+++ b/models/settings.js
@@ -223,7 +223,7 @@ if (Meteor.isServer) {
},
// Gets all connection methods to use it in the Template
- getConnectionsEnabled() {
+ getAuthenticationsEnabled() {
return {
ldap: isLdapEnabled(),
oauth2: isOauth2Enabled(),
diff --git a/models/users.js b/models/users.js
index 27d3e9fa..f8ccb030 100644
--- a/models/users.js
+++ b/models/users.js
@@ -127,10 +127,10 @@ Users.attachSchema(new SimpleSchema({
type: Boolean,
optional: true,
},
- // TODO : write a migration and check if using a ldap parameter is better than a connection_type parameter
- ldap: {
- type: Boolean,
- optional: true,
+ 'authenticationMethod': {
+ type: String,
+ optional: false,
+ defaultValue: 'password',
},
}));
@@ -499,6 +499,7 @@ if (Meteor.isServer) {
user.emails = [{ address: email, verified: true }];
const initials = user.services.oidc.fullname.match(/\b[a-zA-Z]/g).join('').toUpperCase();
user.profile = { initials, fullname: user.services.oidc.fullname };
+ user.authenticationMethod = 'oauth2';
// see if any existing user has this email address or username, otherwise create new
const existingUser = Meteor.users.findOne({$or: [{'emails.address': email}, {'username':user.username}]});
@@ -511,6 +512,7 @@ if (Meteor.isServer) {
existingUser.emails = user.emails;
existingUser.username = user.username;
existingUser.profile = user.profile;
+ existingUser.authenticationMethod = user.authenticationMethod;
Meteor.users.remove({_id: existingUser._id}); // remove existing record
return existingUser;
@@ -525,7 +527,7 @@ if (Meteor.isServer) {
// If ldap, bypass the inviation code if the self registration isn't allowed.
// TODO : pay attention if ldap field in the user model change to another content ex : ldap field to connection_type
if (options.ldap || !disableRegistration) {
- user.ldap = true;
+ user.authenticationMethod = 'ldap';
return user;
}
@@ -645,7 +647,7 @@ if (Meteor.isServer) {
const disableRegistration = Settings.findOne().disableRegistration;
// If ldap, bypass the inviation code if the self registration isn't allowed.
// TODO : pay attention if ldap field in the user model change to another content ex : ldap field to connection_type
- if (!doc.ldap && disableRegistration) {
+ if (doc.authenticationMethod !== 'ldap' && disableRegistration) {
const invitationCode = InvitationCodes.findOne({code: doc.profile.icode, valid: true});
if (!invitationCode) {
throw new Meteor.Error('error-invitation-code-not-exist');