Skip to content

Commit

Permalink
📧 fix: LDAP login after User verification changes (#3003)
Browse files Browse the repository at this point in the history
  • Loading branch information
danny-avila authored Jun 7, 2024
1 parent 1da9211 commit baf0848
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/strategies/ldapStrategy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const LdapStrategy = require('passport-ldapauth');
const { findUser, createUser } = require('~/models/userMethods');
const { findUser, createUser, updateUser } = require('~/models/userMethods');
const fs = require('fs');

const ldapOptions = {
Expand Down Expand Up @@ -49,14 +49,16 @@ const ldapLogin = new LdapStrategy(ldapOptions, async (userinfo, done) => {
emailVerified: true,
name: fullName,
};
const userId = await createUser(user);
user._id = userId;
} else {
user.provider = 'ldap';
user.ldapId = userinfo.uid;
user.username = username;
user.name = fullName;
}

await createUser(user);
user = await updateUser(user._id, user);

done(null, user);
} catch (err) {
Expand Down

0 comments on commit baf0848

Please sign in to comment.