Some minor update

This commit is contained in:
Simon M. Haller-Seeber 2020-05-14 19:51:48 +02:00
parent 26b1aca34b
commit 13b76926ca
3 changed files with 23 additions and 8 deletions

View File

@ -34,6 +34,12 @@ db.users.find({email:"EMAIL"}).pretty()
db.users.update({email : OLDEMAIL},{$set: { email : NEWEMAIL}});
```
## Coming soon
- Option that Admins can invite non LDAP User
## Configuration
### Domain Configuration

View File

@ -48,6 +48,9 @@ services:
LDAP_BINDDN: ou=someunit,ou=people,dc=DOMAIN,dc=TLS
# By default tries to bind directly with the ldap user - this user has to be in the LDAP GROUP
LDAP_GROUP_FILTER: '(memberof=cn=GROUPNAME,ou=groups,dc=DOMAIN,dc=TLD)'
#LDAP_GROUP_FILTER: '(memberof=GROUPNAME,ou=groups,dc=DOMAIN,dc=TLD)'
# if user is in ADMIN_GROUP on user creation (first login) isAdmin is set to true.
#LDAP_ADMIN_GROUP_FILTER: '(memberof=cn=ADMINGROUPNAME,ou=groups,dc=DOMAIN,dc=TLD)'
LDAP_CONTACTS: 'false'
# Same property, unfortunately with different names in

View File

@ -59,7 +59,6 @@ const AuthenticationManager = {
let pass = require("crypto").randomBytes(32).toString("hex")
const userRegHand = require('../User/UserRegistrationHandler.js')
userRegHand.registerNewUser({
//_id: uid,
email: mail,
first_name: firstname,
last_name: lastname,
@ -70,11 +69,7 @@ const AuthenticationManager = {
console.log(error)
}
user.email = mail
if (isAdmin) {
user.admin = true
} else {
user.admin = false
}
user.isAdmin = isAdmin
user.emails[0].confirmedAt = Date.now()
user.save()
//console.log("user %s added to local library: ", mail)
@ -93,8 +88,19 @@ const AuthenticationManager = {
},
authUserObj(error, user, query, password, callback) {
// check if user is in ldap and logon if the ldapuser exists.
AuthenticationManager.ldapAuth(query, password, AuthenticationManager.createIfNotExistAndLogin, callback, user)
// check if user is in ldap and logon if the ldapuser exists
// external email login
if (user && user.hashedPassword) {
console.log("email login for existing user")
bcrypt.compare(password, user.hashedPassword, function (error, match) {
if (match) {
console.log("Fine")
AuthenticationManager.login(user, password, callback)
}
})
} else {
AuthenticationManager.ldapAuth(query, password, AuthenticationManager.createIfNotExistAndLogin, callback, user)
}
return null
},