mirror of
https://github.com/wekan/wekan.git
synced 2026-01-04 00:28:49 +01:00
- [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
This commit is contained in:
parent
96173ad431
commit
39312a075e
8 changed files with 139 additions and 29 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue