summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2018-08-25 00:49:02 +0300
committerLauri Ojansivu <x@xet7.org>2018-08-25 00:49:02 +0300
commit39312a075e5746ddeccbf3fc22df7177a86ba4d5 (patch)
treecfe58a957d423cedfdfa27368ad14c6e0d78ea00 /models
parent96173ad4314cf783f4f7d9c0278762f144d95758 (diff)
downloadwekan-39312a075e5746ddeccbf3fc22df7177a86ba4d5.tar.gz
wekan-39312a075e5746ddeccbf3fc22df7177a86ba4d5.tar.bz2
wekan-39312a075e5746ddeccbf3fc22df7177a86ba4d5.zip
- [OAuth2 Login on Standalone Wekan](https://github.com/wekan/wekan/wiki/OAuth2). For example, Rocket.Chat can provide OAuth2 login to Wekan.
Also, if you have Rocket.Chat using LDAP/SAML/Google/etc for logging into Rocket.Chat, then same users can login to Wekan when Rocket.Chat is providing OAuth2 login to Wekan. Thanks to salleman33 and xet7 ! Closes #234
Diffstat (limited to 'models')
-rw-r--r--models/users.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/models/users.js b/models/users.js
index 6e83337e..1b1b79e1 100644
--- a/models/users.js
+++ b/models/users.js
@@ -479,23 +479,20 @@ if (Meteor.isServer) {
}
if (user.services.oidc) {
- var email = user.services.oidc.email.toLowerCase();
-
+ const email = user.services.oidc.email.toLowerCase();
+
user.username = user.services.oidc.username;
- user.emails = [{ address: email,
- verified: true }];
- var initials = user.services.oidc.fullname.match(/\b[a-zA-Z]/g).join('').toUpperCase();
- user.profile = { initials: initials, fullname: user.services.oidc.fullname };
+ 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 };
// see if any existing user has this email address or username, otherwise create new
- var existingUser = Meteor.users.findOne({$or: [{'emails.address': email}, {'username':user.username}]});
- console.log("user to create : ");
- console.log(user);
+ const existingUser = Meteor.users.findOne({$or: [{'emails.address': email}, {'username':user.username}]});
if (!existingUser)
return user;
// copy across new service info
- var service = _.keys(user.services)[0];
+ const service = _.keys(user.services)[0];
existingUser.services[service] = user.services[service];
existingUser.emails = user.emails;
existingUser.username = user.username;